Created
April 8, 2014 11:56
-
-
Save Deltachaos/10114135 to your computer and use it in GitHub Desktop.
nodejs implementation of sys package. Untyped vs typed using node externs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sys; | |
import js.Node; | |
using StringTools; | |
#if !macro | |
/** | |
This class allows you to get informations about the files and directories. | |
**/ | |
class FileSystem | |
{ | |
/** | |
Tells if the given file or directory exists. | |
**/ | |
inline public static function exists( path : String ) : Bool | |
{ | |
return Node.fs.existsSync(path); | |
} | |
// [...] | |
} | |
#else | |
class FileSystem | |
{} | |
#end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sys; | |
#if !macro | |
/** | |
This class allows you to get informations about the files and directories. | |
**/ | |
class FileSystem | |
{ | |
/** | |
Tells if the given file or directory exists. | |
**/ | |
inline public static function exists( path : String ) : Bool | |
{ | |
return untyped __js__("require('fs').existsSync(path)"); | |
} | |
// [...] | |
} | |
#else | |
class FileSystem | |
{} | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment