Object/Trait

io.scalajs.nodejs.fs

Fs

Related Docs: trait Fs | package fs

Permalink

object Fs extends Object with Fs

File System Singleton

Annotations
@native() @JSImport( "fs" , JSImport.Namespace )
Linear Supertypes
Fs, IEventEmitter, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fs
  2. Fs
  3. IEventEmitter
  4. Object
  5. Any
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val F_OK: FileMode

    Permalink

    File is visible to the calling process.

    File is visible to the calling process. This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.

    Definition Classes
    Fs
  5. val O_APPEND: Int

    Permalink

    Flag indicating that data will be appended to the end of the file.

    Flag indicating that data will be appended to the end of the file.

    Definition Classes
    Fs
  6. val O_CREAT: Int

    Permalink

    Flag indicating to create the file if it does not already exist.

    Flag indicating to create the file if it does not already exist.

    Definition Classes
    Fs
  7. val O_DIRECT: Int

    Permalink

    When set, an attempt will be made to minimize caching effects of file I/O.

    When set, an attempt will be made to minimize caching effects of file I/O.

    Definition Classes
    Fs
  8. val O_DIRECTORY: Int

    Permalink

    Flag indicating that the open should fail if the path is not a directory.

    Flag indicating that the open should fail if the path is not a directory.

    Definition Classes
    Fs
  9. val O_EXCL: Int

    Permalink

    Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists.

    Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists.

    Definition Classes
    Fs
  10. val O_NOATIME: Int

    Permalink

    Flag indicating reading accesses to the file system will no longer result in an update to the atime information associated with the file.

    Flag indicating reading accesses to the file system will no longer result in an update to the atime information associated with the file. This flag is available on Linux operating systems only.

    Definition Classes
    Fs
  11. val O_NOCTTY: Int

    Permalink

    Flag indicating that if path identifies a terminal device, opening the path shall not cause that terminal to become the controlling terminal for the process (if the process does not already have one).

    Flag indicating that if path identifies a terminal device, opening the path shall not cause that terminal to become the controlling terminal for the process (if the process does not already have one).

    Definition Classes
    Fs
  12. val O_NOFOLLOW: Int

    Permalink

    Flag indicating that the open should fail if the path is a symbolic link.

    Flag indicating that the open should fail if the path is a symbolic link.

    Definition Classes
    Fs
  13. val O_NONBLOCK: Int

    Permalink

    Flag indicating to open the file in nonblocking mode when possible.

    Flag indicating to open the file in nonblocking mode when possible.

    Definition Classes
    Fs
  14. val O_RDONLY: Int

    Permalink

    Flag indicating to open a file for read-only access.

    Flag indicating to open a file for read-only access.

    Definition Classes
    Fs
  15. val O_RDWR: Int

    Permalink

    Flag indicating to open a file for read-write access.

    Flag indicating to open a file for read-write access.

    Definition Classes
    Fs
  16. val O_SYMLINK: Int

    Permalink

    Flag indicating to open the symbolic link itself rather than the resource it is pointing to.

    Flag indicating to open the symbolic link itself rather than the resource it is pointing to.

    Definition Classes
    Fs
  17. val O_SYNC: Int

    Permalink

    Flag indicating that the file is opened for synchronous I/O.

    Flag indicating that the file is opened for synchronous I/O.

    Definition Classes
    Fs
  18. val O_TRUNC: Int

    Permalink

    Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero.

    Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero.

    Definition Classes
    Fs
  19. val O_WRONLY: Int

    Permalink

    Flag indicating to open a file for write-only access.

    Flag indicating to open a file for write-only access.

    Definition Classes
    Fs
  20. val R_OK: FileMode

    Permalink

    File can be read by the calling process.

    File can be read by the calling process.

    Definition Classes
    Fs
  21. val S_IFBLK: FileType

    Permalink

    File type constant for a block-oriented device file.

    File type constant for a block-oriented device file.

    Definition Classes
    Fs
  22. val S_IFCHR: FileType

    Permalink

    File type constant for a character-oriented device file.

    File type constant for a character-oriented device file.

    Definition Classes
    Fs
  23. val S_IFDIR: FileType

    Permalink

    File type constant for a directory.

    File type constant for a directory.

    Definition Classes
    Fs
  24. val S_IFIFO: FileType

    Permalink

    File type constant for a FIFO/pipe.

    File type constant for a FIFO/pipe.

    Definition Classes
    Fs
  25. val S_IFLNK: FileType

    Permalink

    File type constant for a symbolic link.

    File type constant for a symbolic link.

    Definition Classes
    Fs
  26. val S_IFMT: FileType

    Permalink

    Bit mask used to extract the file type code.

    Bit mask used to extract the file type code.

    Definition Classes
    Fs
  27. val S_IFREG: FileType

    Permalink

    File type constant for a regular file.

    File type constant for a regular file.

    Definition Classes
    Fs
  28. val S_IFSOCK: FileType

    Permalink

    File type constant for a socket.

    File type constant for a socket.

    Definition Classes
    Fs
  29. val W_OK: FileMode

    Permalink

    File can be written by the calling process.

    File can be written by the calling process.

    Definition Classes
    Fs
  30. val X_OK: FileMode

    Permalink

    File can be executed by the calling process.

    File can be executed by the calling process. This has no effect on Windows (will behave like F_OK).

    Definition Classes
    Fs
  31. def access(path: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Tests a user's permissions for the file specified by path.

    Tests a user's permissions for the file specified by path. mode is an optional integer that specifies the accessibility checks to be performed. The following constants define the possible values of mode. It is possible to create a mask consisting of the bitwise OR of two or more values.

    • fs.F_OK - File is visible to the calling process. This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.
    • R_OK - File can be read by the calling process.
    • W_OK - File can be written by the calling process.
    • X_OK - File can be executed by the calling process. This has no effect on Windows (will behave like F_OK).
    path

    the path (Buffer | String)

    callback

    is a callback function that is invoked with a possible error argument. If any of the accessibility checks fail, the error argument will be populated.

    Definition Classes
    Fs
    Example:
    1. fs.access(path[, mode], callback)

  32. def access(path: |[Buffer, String], mode: FileMode, callback: FsCallback0): Unit

    Permalink

    Tests a user's permissions for the file specified by path.

    Tests a user's permissions for the file specified by path. mode is an optional integer that specifies the accessibility checks to be performed. The following constants define the possible values of mode. It is possible to create a mask consisting of the bitwise OR of two or more values.

    • fs.F_OK - File is visible to the calling process. This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.
    • R_OK - File can be read by the calling process.
    • W_OK - File can be written by the calling process.
    • X_OK - File can be executed by the calling process. This has no effect on Windows (will behave like F_OK).
    path

    the path (Buffer | String)

    mode

    the optional mode

    callback

    is a callback function that is invoked with a possible error argument. If any of the accessibility checks fail, the error argument will be populated.

    Definition Classes
    Fs
    Example:
    1. fs.access(path[, mode], callback)

  33. def accessSync(path: |[Buffer, String], mode: FileMode = js.native): Unit

    Permalink

    Synchronous version of fs.access().

    Synchronous version of fs.access(). This throws if any accessibility checks fail, and does nothing otherwise.

    path

    the path (Buffer | String)

    mode

    the optional mode

    Definition Classes
    Fs
    Example:
    1. fs.accessSync(path[, mode])

  34. def addListener(eventName: String, listener: Function): Fs.this.type

    Permalink

    Alias for emitter.on(eventName, listener).

    Alias for emitter.on(eventName, listener).

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.addListener(eventName, listener)

    See also

    on()

  35. def appendFile(file: |[|[Buffer, FileDescriptor], String], data: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronously append data to a file, creating the file if it does not yet exist.

    Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a buffer.

    file

    the filename or file descriptor (Buffer | String | Number)

    data

    the data to append (Buffer | String)

    callback

    the callback function

    Definition Classes
    Fs
    Example:
    1. fs.appendFile(file, data[, options], callback)

  36. def appendFile(file: |[|[Buffer, FileDescriptor], String], data: |[Buffer, String], options: |[FileAppendOptions, RawOptions], callback: FsCallback0): Unit

    Permalink

    Asynchronously append data to a file, creating the file if it does not yet exist.

    Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a buffer.

    file

    the filename or file descriptor (Buffer | String | Number)

    data

    the data to append (Buffer | String)

    options

    the optional append settings

    callback

    the callback function

    Definition Classes
    Fs
    Example:
    1. fs.appendFile(file, data[, options], callback)

  37. def appendFileSync(file: |[|[Buffer, FileDescriptor], String], data: |[Buffer, String], options: |[FileAppendOptions, RawOptions] = js.native): Unit

    Permalink

    The synchronous version of fs.appendFile().

    The synchronous version of fs.appendFile().

    file

    the filename or file descriptor (Buffer | String | Number)

    data

    the data to append (Buffer | String)

    options

    the optional append settings

    returns

    undefined.

    Definition Classes
    Fs
  38. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  39. def chmod(path: |[Buffer, String], mode: FileMode, callback: FsCallback0): Unit

    Permalink

    Asynchronous chmod(2).

    Asynchronous chmod(2). No arguments other than a possible exception are given to the completion callback.

    path

    the file or directory path (Buffer | String)

    mode

    the file or directory mode

    callback

    the completion callback.

    Definition Classes
    Fs
  40. def chmodSync(path: |[Buffer, String], mode: FileMode): Unit

    Permalink

    Synchronous chmod(2).

    Synchronous chmod(2).

    path

    the file or directory path (Buffer | String)

    mode

    the file or directory mode

    returns

    undefined.

    Definition Classes
    Fs
  41. def chown(path: |[Buffer, String], uid: UID, gid: GID, callback: FsCallback0): Unit

    Permalink

    Asynchronous chown(2).

    Asynchronous chown(2). No arguments other than a possible exception are given to the completion callback.

    path

    the file or directory path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    callback

    the completion callback.

    Definition Classes
    Fs
  42. def chownSync(path: |[Buffer, String], uid: UID, gid: GID): Unit

    Permalink

    Synchronous chown(2).

    Synchronous chown(2).

    path

    the file or directory path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    returns

    undefined.

    Definition Classes
    Fs
  43. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. def close(fd: FileDescriptor, callback: FsCallback0): Unit

    Permalink

    Asynchronous close(2).

    Asynchronous close(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.close(fd, callback)

  45. def closeSync(fd: FileDescriptor): Unit

    Permalink

    Synchronous close(2).

    Synchronous close(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.closeSync(fd)

  46. def createReadStream(path: |[Buffer, String], options: |[FileInputOptions, RawOptions] = js.native): ReadStream

    Permalink

    Returns a new ReadStream object.

    Returns a new ReadStream object. (See Readable Stream). Be aware that, unlike the default value set for highWaterMark on a readable stream (16 kb), the stream returned by this method has a default value of 64 kb for the same parameter.

    path

    the path (Buffer | String)

    options

    the optional stream options

    Definition Classes
    Fs
    Example:
    1. fs.createReadStream(path[, options])

  47. def createWriteStream(path: |[Buffer, String], options: |[FileOutputOptions, RawOptions] = js.native): WriteStream

    Permalink

    Returns a new WriteStream object.

    Returns a new WriteStream object.

    path

    the path (Buffer | String)

    options

    the optional stream options

    Definition Classes
    Fs
    Example:
    1. fs.createWriteStream(path[, options])

  48. var domain: String

    Permalink
    Definition Classes
    IEventEmitter
  49. def emit(name: String, args: Any*): Any

    Permalink

    Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Returns true if the event had listeners, false otherwise.

    name

    the event name

    args

    the event arguments

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.emit(name[, arg1][, arg2][, ...])

  50. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  51. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  52. def existsSync(path: String): Boolean

    Permalink

    fs.exists() should not be used to check if a file exists before calling fs.open().

    fs.exists() should not be used to check if a file exists before calling fs.open(). Doing so introduces a race condition since other processes may change the file's state between the two calls. Instead, user code should call fs.open() directly and handle the error raised if the file is non-existent.

    Definition Classes
    Fs
    Example:
    1. fs.existsSync(path)

  53. def fchmod(fd: FileDescriptor, mode: FileMode, callback: FsCallback0): Unit

    Permalink

    Asynchronous fchmod(2).

    Asynchronous fchmod(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.fchmod(fd, mode, callback)

  54. def fchmodSync(fd: FileDescriptor, mode: FileMode): Unit

    Permalink

    Synchronous fchmod(2).

    Synchronous fchmod(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.fchmodSync(fd, mode)

  55. def fchown(path: |[Buffer, String], uid: UID, gid: GID, callback: FsCallback0): Unit

    Permalink

    Asynchronous fchown(2).

    Asynchronous fchown(2). No arguments other than a possible exception are given to the completion callback.

    path

    the file or directory path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    callback

    the completion callback.

    Definition Classes
    Fs
  56. def fchownSync(path: |[Buffer, String], uid: UID, gid: GID): Unit

    Permalink

    Synchronous fchown(2).

    Synchronous fchown(2).

    path

    the file or directory path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    returns

    undefined.

    Definition Classes
    Fs
  57. def fdatasync(fd: FileDescriptor, callback: FsCallback0): Unit

    Permalink

    Asynchronous fdatasync(2).

    Asynchronous fdatasync(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.fdatasync(fd, callback)

  58. def fdatasyncSync(fd: FileDescriptor): Unit

    Permalink

    Synchronous fdatasync(2).

    Synchronous fdatasync(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.fdatasyncSync(fd)

  59. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  60. def fstat(fd: FileDescriptor, callback: FsCallback1[Stats]): Unit

    Permalink

    Asynchronous fstat(2).

    Asynchronous fstat(2). The callback gets two arguments (err, stats) where stats is an fs.Stats object. fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor fd.

    fd

    the file descriptor

    callback

    the completion callback.

    Definition Classes
    Fs
  61. def fstatSync(fd: FileDescriptor): Stats

    Permalink

    Synchronous fstat(2).

    Synchronous fstat(2).

    fd

    the file descriptor

    returns

    an instance of fs.Stats.

    Definition Classes
    Fs
  62. def fsync(fd: FileDescriptor, callback: FsCallback0): Unit

    Permalink

    Asynchronous fsync(2).

    Asynchronous fsync(2). No arguments other than a possible exception are given to the completion callback.

    fd

    the file descriptor

    callback

    the completion callback.

    Definition Classes
    Fs
  63. def fsyncSync(fd: FileDescriptor): Unit

    Permalink

    Synchronous fsync(2).

    Synchronous fsync(2).

    fd

    the file descriptor

    returns

    undefined.

    Definition Classes
    Fs
  64. def ftruncate(fd: FileDescriptor, length: Double, callback: FsCallback0): Unit

    Permalink

    Asynchronous ftruncate(2).

    Asynchronous ftruncate(2). No arguments other than a possible exception are given to the completion callback. If the file referred to by the file descriptor was larger than length bytes, only the first length bytes will be retained in the file.

    fd

    the file descriptor

    length

    the desired length

    callback

    the completion callback.

    Definition Classes
    Fs
  65. def ftruncateSync(fd: FileDescriptor, length: Double): Unit

    Permalink

    Synchronous ftruncate(2).

    Synchronous ftruncate(2).

    fd

    the file descriptor

    length

    the desired length

    returns

    undefined.

    Definition Classes
    Fs
  66. def futimes(fd: FileDescriptor, atime: Integer, mtime: Integer, callback: Function): Unit

    Permalink

    Change the file timestamps of a file referenced by the supplied file descriptor.

    Change the file timestamps of a file referenced by the supplied file descriptor.

    Definition Classes
    Fs
    Example:
    1. fs.futimes(fd, atime, mtime, callback)

  67. def futimesSync(fd: FileDescriptor, atime: Integer, mtime: Integer): Unit

    Permalink

    Synchronous version of fs.futimes().

    Synchronous version of fs.futimes().

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.futimesSync(fd, atime, mtime)

  68. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  69. def getMaxListeners(): Int

    Permalink

    Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

    Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.getMaxListeners()

    See also

    setMaxListeners()

  70. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  71. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  72. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  73. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  74. def lchmod(path: |[Buffer, String], mode: FileMode, callback: FsCallback0): Unit

    Permalink

    Asynchronous lchmod(2).

    Asynchronous lchmod(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.lchmod(path, mode, callback)

  75. def lchmodSync(path: |[Buffer, String], mode: FileMode): Unit

    Permalink

    Synchronous lchmod(2).

    Synchronous lchmod(2).

    path

    the path (Buffer | String)

    mode

    the mode (Integer)

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.lchmodSync(path, mode)

  76. def lchown(path: |[Buffer, String], uid: UID, gid: GID, callback: FsCallback0): Unit

    Permalink

    Asynchronous lchown(2).

    Asynchronous lchown(2). No arguments other than a possible exception are given to the completion callback.

    path

    the path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    callback

    the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.lchown(path, uid, gid, callback)

  77. def lchownSync(path: |[Buffer, String], uid: UID, gid: GID): Unit

    Permalink

    Synchronous chown(2).

    Synchronous chown(2).

    path

    the path (Buffer | String)

    uid

    the user ID

    gid

    the group ID

    returns

    undefined.

    Definition Classes
    Fs
  78. def link(existingPath: |[Buffer, String], newPath: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronous link(2).

    Asynchronous link(2). No arguments other than a possible exception are given to the completion callback.

    existingPath

    the existing path

    newPath

    the new path

    callback

    the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.link(srcpath, dstpath, callback)

  79. def linkSync(existingPath: |[Buffer, String], newPath: |[Buffer, String]): Unit

    Permalink

    Synchronous link(2).

    Synchronous link(2).

    existingPath

    the existing path

    newPath

    the new path

    returns

    undefined.

    Definition Classes
    Fs
  80. def listenerCount(eventName: String): Int

    Permalink

    Returns the number of listeners listening to the event named eventName.

    Returns the number of listeners listening to the event named eventName.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.listenerCount(eventName)

  81. def listeners(eventName: String): Array[Function]

    Permalink

    Returns a copy of the array of listeners for the event named eventName.

    Returns a copy of the array of listeners for the event named eventName.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.listeners(eventName)

  82. def lstat(path: |[Buffer, String], callback: FsCallback1[Stats]): Unit

    Permalink

    Asynchronous lstat(2).

    Asynchronous lstat(2). lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to.

    path

    the path (Buffer | String)

    callback

    The callback gets two arguments (err, stats) where stats is a fs.Stats object.

    Definition Classes
    Fs
  83. def lstatSync(path: |[Buffer, String]): Stats

    Permalink

    Synchronous lstat(2).

    Synchronous lstat(2).

    path

    the path (Buffer | String)

    returns

    an instance of fs.Stats.

    Definition Classes
    Fs
  84. def mkdir(path: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronous mkdir(2).

    Asynchronous mkdir(2). No arguments other than a possible exception are given to the completion callback. mode defaults to 0o777.

    Definition Classes
    Fs
    Example:
    1. fs.mkdir(path[, mode], callback)

  85. def mkdir(path: |[Buffer, String], mode: FileMode, callback: FsCallback0): Unit

    Permalink

    Asynchronous mkdir(2).

    Asynchronous mkdir(2). No arguments other than a possible exception are given to the completion callback. mode defaults to 0o777.

    Definition Classes
    Fs
    Example:
    1. fs.mkdir(path[, mode], callback)

  86. def mkdirSync(path: |[Buffer, String], mode: FileMode = js.native): Unit

    Permalink

    Synchronous mkdir(2).

    Synchronous mkdir(2).

    path

    the path

    mode

    the mode

    Definition Classes
    Fs
  87. def mkdtemp(prefix: String, callback: FsCallback1[String]): Unit

    Permalink

    Creates a unique temporary directory.

    Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. The created folder path is passed as a string to the callback's second parameter. The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.

    prefix

    the prefix

    callback

    the callback

    Definition Classes
    Fs
    Example:
    1. fs.mkdtemp(prefix[, options], callback)

  88. def mkdtemp(prefix: String, options: |[|[String, FileEncodingOptions], RawOptions], callback: FsCallback1[String]): Unit

    Permalink

    Creates a unique temporary directory.

    Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. The created folder path is passed as a string to the callback's second parameter. The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.

    prefix

    the prefix

    options

    the optional encoding setting

    callback

    the callback

    Definition Classes
    Fs
    Example:
    1. fs.mkdtemp(prefix[, options], callback)

  89. def mkdtempSync(prefix: String, options: |[|[String, FileEncodingOptions], RawOptions] = js.native): String

    Permalink

    The synchronous version of fs.mkdtemp().

    The synchronous version of fs.mkdtemp(). Returns the created folder path. The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.

    prefix

    the prefix

    options

    the optional encoding setting

    Definition Classes
    Fs
  90. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  91. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  92. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  93. def on(eventName: String, listener: Function): Fs.this.type

    Permalink

    Adds the listener function to the end of the listeners array for the event named eventName.

    Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

    Returns a reference to the EventEmitter so calls can be chained.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.on(eventName, listener)

  94. def once(eventName: String, listener: Function): Fs.this.type

    Permalink

    Adds a one time listener function for the event named eventName.

    Adds a one time listener function for the event named eventName. This listener is invoked only the next time eventName is triggered, after which it is removed.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.once(eventName, listener)

  95. def open(path: |[Buffer, String], flags: Flags, callback: FsCallback1[FileDescriptor]): Unit

    Permalink

    Asynchronous file open.

    Asynchronous file open. See open(2).

    path

    the path (Buffer | String)

    flags

    flags can be:

    • 'r' - Open file for reading. An exception occurs if the file does not exist.
    • 'r+' - Open file for reading and writing. An exception occurs if the file does not exist.
    • 'rs+' - Open file for reading and writing in synchronous mode. Instructs the operating system to bypass the local file system cache. This is primarily useful for opening files on NFS mounts as it allows you to skip the potentially stale local cache. It has a very real impact on I/O performance so don't use this flag unless you need it. Note that this doesn't turn fs.open() into a synchronous blocking call. If that's what you want then you should be using fs.openSync()
    • 'w' - Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
    • 'wx' - Like 'w' but fails if path exists.
    • 'w+' - Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
    • 'wx+' - Like 'w+' but fails if path exists.
    • 'a' - Open file for appending. The file is created if it does not exist.
    • 'ax' - Like 'a' but fails if path exists.
    • 'a+' - Open file for reading and appending. The file is created if it does not exist.
    • 'ax+' - Like 'a+' but fails if path exists.
    callback

    the callback gets two arguments (err, fd)

    Definition Classes
    Fs
    Example:
    1. fs.open(path, flags[, mode], callback)

  96. def open(path: |[Buffer, String], flags: Flags, mode: FileMode, callback: FsCallback1[FileDescriptor]): Unit

    Permalink

    Asynchronous file open.

    Asynchronous file open. See open(2).

    path

    the path (Buffer | String)

    flags

    flags can be:

    • 'r' - Open file for reading. An exception occurs if the file does not exist.
    • 'r+' - Open file for reading and writing. An exception occurs if the file does not exist.
    • 'rs+' - Open file for reading and writing in synchronous mode. Instructs the operating system to bypass the local file system cache. This is primarily useful for opening files on NFS mounts as it allows you to skip the potentially stale local cache. It has a very real impact on I/O performance so don't use this flag unless you need it. Note that this doesn't turn fs.open() into a synchronous blocking call. If that's what you want then you should be using fs.openSync()
    • 'w' - Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
    • 'wx' - Like 'w' but fails if path exists.
    • 'w+' - Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
    • 'wx+' - Like 'w+' but fails if path exists.
    • 'a' - Open file for appending. The file is created if it does not exist.
    • 'ax' - Like 'a' but fails if path exists.
    • 'a+' - Open file for reading and appending. The file is created if it does not exist.
    • 'ax+' - Like 'a+' but fails if path exists.
    mode

    sets the file mode (permission and sticky bits), but only if the file was created. It defaults to 0666, readable and writable.

    callback

    the callback gets two arguments (err, fd)

    Definition Classes
    Fs
    Example:
    1. fs.open(path, flags[, mode], callback)

  97. def openSync(path: |[Buffer, String], flags: Flags, mode: FileMode = js.native): FileDescriptor

    Permalink

    Synchronous version of fs.open().

    Synchronous version of fs.open().

    path

    the path (Buffer | String)

    flags

    the flags

    mode

    the file mode

    returns

    an integer representing the file descriptor.

    Definition Classes
    Fs
    Example:
    1. fs.openSync(path, flags[, mode])

  98. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  99. def read(fd: FileDescriptor, buffer: Buffer, offset: Int, length: Int, position: Int, callback: FsCallback2[Int, Buffer]): Unit

    Permalink

    Read data from the file specified by fd.

    Read data from the file specified by fd.

    fd

    is the file descriptor

    buffer

    is the buffer that the data will be written to.

    offset

    is the offset in the buffer to start writing at.

    length

    is an integer specifying the number of bytes to read.

    position

    is an integer specifying where to begin reading from in the file. If position is null, data will be read from the current file position.

    callback

    the callback is given the three arguments, (err, bytesRead, buffer).

    Definition Classes
    Fs
  100. def readFile(file: |[|[Buffer, FileDescriptor], String], callback: FsCallback1[Buffer]): Unit

    Permalink

    Asynchronously reads the entire contents of a file.

    Asynchronously reads the entire contents of a file.

    file

    filename or file descriptor

    callback

    The callback is passed two arguments (err, data), where data is the contents of the file. If no encoding is specified, then the raw buffer is returned.

    Definition Classes
    Fs
    Example:
    1. fs.readFile(file[, options], callback)

  101. def readFile(file: |[|[Buffer, FileDescriptor], String], encoding: String, callback: FsCallback1[String]): Unit

    Permalink

    Asynchronously reads the entire contents of a file.

    Asynchronously reads the entire contents of a file.

    file

    filename or file descriptor

    encoding

    the encoding (default = null)

    callback

    The callback is passed two arguments (err, data), where data is the contents of the file. If no encoding is specified, then the raw buffer is returned.

    Definition Classes
    Fs
    Example:
    1. fs.readFile(file[, options], callback)

  102. def readFile(file: String, options: |[|[|[String, FileInputOptions], RawOptions], String], callback: FsCallback1[Any]): Unit

    Permalink

    Asynchronously reads the entire contents of a file.

    Asynchronously reads the entire contents of a file.

    file

    filename or file descriptor

    options

    the optional settings

    callback

    The callback is passed two arguments (err, data), where data is the contents of the file. If no encoding is specified, then the raw buffer is returned.

    Definition Classes
    Fs
    Example:
    1. fs.readFile(file[, options], callback)

  103. def readFileSync(file: |[|[Buffer, FileDescriptor], String]): Buffer

    Permalink

    Synchronous version of fs.readFile.

    Synchronous version of fs.readFile.

    file

    filename or file descriptor <String> | <Buffer> | <Integer>

    returns

    the contents of the file. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer.

    Definition Classes
    Fs
    Example:
    1. fs.readFileSync(file[, options])

  104. def readFileSync(file: |[|[Buffer, FileDescriptor], String], options: |[FileInputOptions, RawOptions] = js.native): Any

    Permalink

    Synchronous version of fs.readFile.

    Synchronous version of fs.readFile. Returns the contents of the file.

    file

    filename or file descriptor <String> | <Buffer> | <Integer>

    options

    the optional encoding <Object> | <String>

    returns

    the contents of the file. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer.

    Definition Classes
    Fs
    Example:
    1. fs.readFileSync(file[, options])

  105. def readFileSync(file: |[|[Buffer, FileDescriptor], String], encoding: String): String

    Permalink

    Synchronous version of fs.readFile.

    Synchronous version of fs.readFile. Returns the contents of the file.

    file

    filename or file descriptor <String> | <Buffer> | <Integer>

    encoding

    the optional encoding <Object> | <String>

    returns

    the contents of the file. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer.

    Definition Classes
    Fs
    Example:
    1. fs.readFileSync(file[, options])

  106. def readSync(fd: FileDescriptor, buffer: Buffer, offset: Int, length: Int, position: Int): Buffer

    Permalink

    Synchronous version of fs.read().

    Synchronous version of fs.read().

    fd

    is the file descriptor

    buffer

    is the buffer that the data will be written to.

    offset

    is the offset in the buffer to start writing at.

    length

    is an integer specifying the number of bytes to read.

    position

    is an integer specifying where to begin reading from in the file. If position is null, data will be read from the current file position.

    returns

    the number of bytesRead.

    Definition Classes
    Fs
  107. def readdir(path: |[Buffer, String], callback: FsCallback1[Array[String]]): Unit

    Permalink

    Asynchronous readdir(3).

    Asynchronous readdir(3). Reads the contents of a directory.

    path

    the path (Buffer | String)

    callback

    the callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

    Definition Classes
    Fs
    Example:
    1. fs.readdir(path[, options], callback)

  108. def readdir(path: |[Buffer, String], options: |[|[String, FileEncodingOptions], RawOptions], callback: FsCallback1[Array[String]]): Unit

    Permalink

    Asynchronous readdir(3).

    Asynchronous readdir(3). Reads the contents of a directory.

    path

    the path (Buffer | String)

    options

    the optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the filenames passed to the callback. If the encoding is set to 'buffer', the filenames returned will be passed as Buffer objects.

    callback

    the callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

    Definition Classes
    Fs
    Example:
    1. fs.readdir(path[, options], callback)

  109. def readdirSync(path: |[Buffer, String], options: |[|[String, FileEncodingOptions], RawOptions] = js.native): Array[String]

    Permalink

    Synchronous readdir(3).

    Synchronous readdir(3).

    path

    the path (Buffer | String)

    options

    the optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the filenames passed to the callback. If the encoding is set to 'buffer', the filenames returned will be passed as Buffer objects.

    returns

    an array of filenames excluding '.' and '..'.

    Definition Classes
    Fs
  110. def readlink(path: |[Buffer, String], options: |[|[String, FileEncodingOptions], RawOptions], callback: FsCallback1[String]): Unit

    Permalink

    Asynchronous readlink(2).

    Asynchronous readlink(2). If the encoding is set to 'buffer', the link path returned will be passed as a Buffer object.

    path

    the path (Buffer | String)

    options

    the optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the link path passed to the callback.

    callback

    the callback gets two arguments (err, linkString).

    Definition Classes
    Fs
    Example:
    1. fs.readlink(path[, options], callback)

  111. def readlinkSync(path: |[Buffer, String], options: |[|[String, FileEncodingOptions], RawOptions] = js.native): String

    Permalink

    Synchronous readlink(2).

    Synchronous readlink(2).

    path

    the path (Buffer | String)

    options

    the optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the link path passed to the callback. If the encoding is set to 'buffer', the link path returned will be passed as a Buffer object.

    returns

    the symbolic link's string value.

    Definition Classes
    Fs
  112. def realpath(path: |[Buffer, String], callback: FsCallback1[String]): Unit

    Permalink

    Asynchronous realpath(2).

    Asynchronous realpath(2). The callback gets two arguments (err, resolvedPath). May use process.cwd to resolve relative paths.

    The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the path passed to the callback. If the encoding is set to 'buffer', the path returned will be passed as a Buffer object.

    Definition Classes
    Fs
    Example:
    1. fs.realpath(path[, options], callback)

  113. def realpath(path: |[Buffer, String], options: |[|[FileEncodingOptions, String], RawOptions], callback: FsCallback1[String]): Unit

    Permalink

    Asynchronous realpath(2).

    Asynchronous realpath(2). May use process.cwd to resolve relative paths.

    path

    the path

    options

    The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the path passed to the callback.

    callback

    The callback gets two arguments (err, resolvedPath). If the encoding is set to 'buffer', the path returned will be passed as a Buffer object.

    Definition Classes
    Fs
    Example:
    1. fs.realpath(path[, options], callback)

  114. def realpathSync(path: |[Buffer, String], options: |[|[FileEncodingOptions, String], RawOptions] = js.native): String

    Permalink

    Synchronous realpath(3).

    Synchronous realpath(3). Only paths that can be converted to UTF8 strings are supported. The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the returned value. If the encoding is set to 'buffer', the path returned will be passed as a Buffer object.

    returns

    the resolved path.

    Definition Classes
    Fs
    Example:
    1. fs.realpathSync(path[, options])

  115. def removeAllListeners(): Fs.this.type

    Permalink

    Removes all listeners, or those of the specified eventName.

    Removes all listeners, or those of the specified eventName.

    Note that it is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

    Returns a reference to the EventEmitter so calls can be chained.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.removeAllListeners([eventName])

  116. def removeAllListeners(eventName: String): Fs.this.type

    Permalink

    Removes all listeners, or those of the specified eventName.

    Removes all listeners, or those of the specified eventName.

    Note that it is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

    Returns a reference to the EventEmitter so calls can be chained.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.removeAllListeners([eventName])

  117. def removeListener(eventName: String, listener: Function): Fs.this.type

    Permalink

    Removes the specified listener from the listener array for the event named eventName.

    Removes the specified listener from the listener array for the event named eventName. removeListener will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener must be called multiple times to remove each instance.

    Note that once an event has been emitted, all listeners attached to it at the time of emitting will be called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them from emit() in progress. Subsequent events will behave as expected.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.removeListener(eventName, listener)

  118. def rename(oldPath: String, newPath: String, callback: FsCallback0): Unit

    Permalink

    Asynchronous rename(2).

    Asynchronous rename(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.rename(oldPath, newPath, callback)

  119. def renameSync(oldPath: String, newPath: String): Unit

    Permalink

    Synchronous rename(2).

    Synchronous rename(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.renameSync(oldPath, newPath)

  120. def rmdir(path: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronous rmdir(2).

    Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.rmdir(path, callback)

  121. def rmdirSync(path: |[Buffer, String]): Unit

    Permalink

    Synchronous rmdir(2).

    Synchronous rmdir(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.rmdirSync(path)

  122. def setMaxListeners(n: Int): Fs.this.type

    Permalink

    By default EventEmitters will print a warning if more than 10 listeners are added for a particular event.

    By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. Obviously, not all events should be limited to just 10 listeners. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) for to indicate an unlimited number of listeners.

    Returns a reference to the EventEmitter so calls can be chained.

    Definition Classes
    IEventEmitter
    Example:
    1. emitter.setMaxListeners(n)

  123. def stat(path: |[Buffer, String], callback: FsCallback1[Stats]): Stats

    Permalink

    Asynchronous stat(2).

    Asynchronous stat(2). The callback gets two arguments (err, stats) where stats is a fs.Stats object. See the fs.Stats section for more information.

    Definition Classes
    Fs
    Example:
    1. fs.stat(path, callback)

  124. def statSync(path: |[Buffer, String]): Stats

    Permalink

    Synchronous stat(2).

    Synchronous stat(2). Returns an instance of fs.Stats.

    Definition Classes
    Fs
    Example:
    1. fs.statSync(path)

  125. def symlink(target: |[Buffer, String], path: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronous symlink(2).

    Asynchronous symlink(2). No arguments other than a possible exception are given to the completion callback. The type argument can be set to 'dir', 'file', or 'junction' (default is 'file') and is only available on Windows (ignored on other platforms). Note that Windows junction points require the destination path to be absolute. When using 'junction', the target argument will automatically be normalized to absolute path.

    Definition Classes
    Fs
    Example:
    1. fs.symlink(target, path[, type], callback)

  126. def symlink(target: |[Buffer, String], path: |[Buffer, String], type: String, callback: FsCallback0): Unit

    Permalink

    Asynchronous symlink(2).

    Asynchronous symlink(2). No arguments other than a possible exception are given to the completion callback. The type argument can be set to 'dir', 'file', or 'junction' (default is 'file') and is only available on Windows (ignored on other platforms). Note that Windows junction points require the destination path to be absolute. When using 'junction', the target argument will automatically be normalized to absolute path.

    Definition Classes
    Fs
    Example:
    1. fs.symlink(target, path[, type], callback)

  127. def symlinkSync(target: |[Buffer, String], path: |[Buffer, String], type: String = js.native): Unit

    Permalink

    Synchronous symlink(2).

    Synchronous symlink(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.symlinkSync(target, path[, type])

  128. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  129. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  130. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  131. def truncate(path: |[|[Buffer, FileDescriptor], String], length: Int, callback: FsCallback0): Unit

    Permalink

    Asynchronous truncate(2).

    Asynchronous truncate(2). No arguments other than a possible exception are given to the completion callback. A file descriptor can also be passed as the first argument. In this case, fs.ftruncate() is called.

    path

    the path <String> | <Buffer>

    length

    the length

    callback

    the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.truncate(path, length, callback)

  132. def truncateSync(path: |[|[Buffer, FileDescriptor], String], length: Int): Unit

    Permalink

    Synchronous truncate(2).

    Synchronous truncate(2). In this case, fs.ftruncateSync() is called.

    path

    the path or file descriptor - <String> | <Buffer> | <Integer>

    length

    the length

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.truncateSync(path, length)

  133. def unlink(path: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronous unlink(2).

    Asynchronous unlink(2). No arguments other than a possible exception are given to the completion callback.

    Definition Classes
    Fs
    Example:
    1. fs.unlink(path, callback)

  134. def unlinkSync(path: |[Buffer, String]): Unit

    Permalink

    Synchronous unlink(2).

    Synchronous unlink(2).

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.unlinkSync(path)

  135. def unwatchFile(filename: |[Buffer, String], listener: FsCallback0 = js.native): Unit

    Permalink

    Stop watching for changes on filename.

    Stop watching for changes on filename. If listener is specified, only that particular listener is removed. Otherwise, all listeners are removed and you have effectively stopped watching filename.

    Calling fs.unwatchFile() with a filename that is not being watched is a no-op, not an error.

    Note: fs.watch() is more efficient than fs.watchFile() and fs.unwatchFile(). fs.watch() should be used instead of fs.watchFile() and fs.unwatchFile() when possible.

    Definition Classes
    Fs
    Example:
    1. fs.unwatchFile(filename[, listener])

  136. var usingDomains: Boolean

    Permalink
    Definition Classes
    IEventEmitter
  137. def utimes(path: |[Buffer, String], atime: Int, mtime: Int, callback: FsCallback0): Unit

    Permalink

    Change file timestamps of the file referenced by the supplied path.

    Change file timestamps of the file referenced by the supplied path.

    Note: the arguments atime and mtime of the following related functions does follow the below rules:

    If the value is a numberable string like '123456789', the value would get converted to corresponding number. If the value is NaN or Infinity, the value would get converted to Date.now().

    Definition Classes
    Fs
    Example:
    1. fs.utimes(path, atime, mtime, callback)

  138. def utimesSync(path: |[Buffer, String], atime: Int, mtime: Int): Unit

    Permalink

    Synchronous version of fs.utimes().

    Synchronous version of fs.utimes().

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.utimesSync(path, atime, mtime)

  139. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  140. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  141. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  142. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  143. def watch(filename: |[Buffer, String], options: |[FSWatcherOptions, RawOptions] = js.native): FSWatcher

    Permalink

    Watch for changes on filename, where filename is either a file or a directory.

    Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher.

    The second argument is optional. If options is provided as a string, it specifies the encoding. Otherwise options should be passed as an object.

    The listener callback gets two arguments (event, filename). event is either 'rename' or 'change', and filename is the name of the file which triggered the event.

    filename

    the filename (Buffer | String)

    options

    the optional settings

    returns

    a FSWatcher

    Definition Classes
    Fs
    Example:
    1. fs.watch(filename[, options][, listener])

  144. def watch(filename: |[Buffer, String], listener: Function2[EventType, String, Any]): FSWatcher

    Permalink

    Watch for changes on filename, where filename is either a file or a directory.

    Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher.

    The second argument is optional. If options is provided as a string, it specifies the encoding. Otherwise options should be passed as an object.

    The listener callback gets two arguments (event, filename). event is either 'rename' or 'change', and filename is the name of the file which triggered the event.

    filename

    the filename (Buffer | String)

    listener

    the listener callback gets two arguments (eventType, filename). eventType is either 'rename' or 'change', and filename is the name of the file which triggered the event.

    returns

    a FSWatcher

    Definition Classes
    Fs
    Example:
    1. fs.watch(filename[, options][, listener])

  145. def watch(filename: |[Buffer, String], options: |[FSWatcherOptions, RawOptions], listener: Function2[EventType, String, Any]): FSWatcher

    Permalink

    Watch for changes on filename, where filename is either a file or a directory.

    Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher.

    The second argument is optional. If options is provided as a string, it specifies the encoding. Otherwise options should be passed as an object.

    The listener callback gets two arguments (event, filename). event is either 'rename' or 'change', and filename is the name of the file which triggered the event.

    filename

    the filename (Buffer | String)

    options

    the optional settings

    listener

    the callback function

    returns

    a FSWatcher

    Definition Classes
    Fs
    Example:
    1. fs.watch(filename[, options][, listener])

  146. def watchFile(filename: |[Buffer, String], listener: FsCallback2[Stats, Stats]): Unit

    Permalink

    Watch for changes on filename.

    Watch for changes on filename. The callback listener will be called each time the file is accessed.

    The options argument may be omitted. If provided, it should be an object. The options object may contain a boolean named persistent that indicates whether the process should continue to run as long as files are being watched. The options object may specify an interval property indicating how often the target should be polled in milliseconds. The default is { persistent: true, interval: 5007 }.

    filename

    the filename (Buffer | String)

    listener

    the callback

    Definition Classes
    Fs
  147. def watchFile(filename: |[Buffer, String], options: |[FileWatcherOptions, RawOptions], listener: FsCallback2[Stats, Stats]): Unit

    Permalink

    Watch for changes on filename.

    Watch for changes on filename. The callback listener will be called each time the file is accessed.

    The options argument may be omitted. If provided, it should be an object. The options object may contain a boolean named persistent that indicates whether the process should continue to run as long as files are being watched. The options object may specify an interval property indicating how often the target should be polled in milliseconds. The default is { persistent: true, interval: 5007 }.

    filename

    the filename (Buffer | String)

    options

    the optional settings

    listener

    the callback

    Definition Classes
    Fs
  148. def write(fd: FileDescriptor, string: String, callback: FsCallback2[Int, String]): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd. If string is not a string, then the value will be coerced to one. Unlike when writing buffer, the entire string must be written. No substring may be specified. This is because the byte offset of the resulting data may not be the same as the string offset. Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly recommended. On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    fd

    the file descriptor

    string

    the data to write

    callback

    will receive the arguments (err, written, string) where written specifies how many bytes the passed string required to be written. Note that bytes written is not the same as string characters. See Buffer.byteLength.

    Definition Classes
    Fs
    Example:
    1. fs.write(fd, string[, position[, encoding]], callback)
  149. def write(fd: FileDescriptor, string: String, encoding: String, callback: FsCallback2[Int, String]): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd. If string is not a string, then the value will be coerced to one. Unlike when writing buffer, the entire string must be written. No substring may be specified. This is because the byte offset of the resulting data may not be the same as the string offset. Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly recommended. On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    fd

    the file descriptor

    string

    the data to write

    encoding

    is the expected string encoding.

    callback

    will receive the arguments (err, written, string) where written specifies how many bytes the passed string required to be written. Note that bytes written is not the same as string characters. See Buffer.byteLength.

    Definition Classes
    Fs
    Example:
    1. fs.write(fd, string[, position[, encoding]], callback)
  150. def write(fd: FileDescriptor, string: String, position: Int, encoding: String, callback: FsCallback2[Int, String]): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd. If string is not a string, then the value will be coerced to one. Unlike when writing buffer, the entire string must be written. No substring may be specified. This is because the byte offset of the resulting data may not be the same as the string offset. Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly recommended. On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    fd

    the file descriptor

    string

    the data to write

    position

    refers to the offset from the beginning of the file where this data should be written. If typeof position !== 'number' the data will be written at the current position. See pwrite(2).

    encoding

    is the expected string encoding.

    callback

    will receive the arguments (err, written, string) where written specifies how many bytes the passed string required to be written. Note that bytes written is not the same as string characters. See Buffer.byteLength.

    Definition Classes
    Fs
    Example:
    1. fs.write(fd, string[, position[, encoding]], callback)
  151. def write(fd: FileDescriptor, buffer: |[Buffer, Uint8Array], callback: FsCallback2[Int, Buffer]): Unit

    Permalink

    Write buffer to the file specified by fd.

    Write buffer to the file specified by fd.

    Note: that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly recommended.

    On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    fd

    the file descriptor

    buffer

    the buffer containing the data to write If typeof position !== 'number', the data will be written at the current position. See pwrite(2).

    callback

    will be given three arguments (err, written, buffer) where written specifies how many bytes were written from buffer.

    Definition Classes
    Fs
    Example:
    1. fs.write(fd, buffer[, offset[, length[, position]]], callback)
  152. def write(fd: FileDescriptor, buffer: |[Buffer, Uint8Array], offset: Integer = js.native, length: Integer = js.native, position: Integer = js.native, callback: FsCallback2[Int, Buffer]): Unit

    Permalink

    Write buffer to the file specified by fd.

    Write buffer to the file specified by fd.

    Note: that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly recommended.

    On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    fd

    the file descriptor

    buffer

    the buffer containing the data to write

    offset

    determines the part of the buffer to be written, and length is an integer specifying the number of bytes to write.

    length

    the optional length of the data to write

    position

    refers to the offset from the beginning of the file where this data should be written. If typeof position !== 'number', the data will be written at the current position. See pwrite(2).

    callback

    will be given three arguments (err, written, buffer) where written specifies how many bytes were written from buffer.

    Definition Classes
    Fs
    Example:
    1. fs.write(fd, buffer[, offset[, length[, position]]], callback)
  153. def writeFile(file: String, data: |[Buffer, String], callback: FsCallback0): Unit

    Permalink

    Asynchronously writes data to a file, replacing the file if it already exists.

    Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer. The encoding option is ignored if data is a buffer. It defaults to 'utf8'

    Definition Classes
    Fs
    Example:
    1. fs.writeFile(file, data[, options], callback)

  154. def writeFile(file: String, data: |[Buffer, String], options: |[FileOutputOptions, RawOptions], callback: FsCallback0): Unit

    Permalink

    Asynchronously writes data to a file, replacing the file if it already exists.

    Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer. The encoding option is ignored if data is a buffer. It defaults to 'utf8'

    Definition Classes
    Fs
    Example:
    1. fs.writeFile(file, data[, options], callback)

  155. def writeFileSync(file: String, data: |[Buffer, String], options: |[FileOutputOptions, RawOptions] = js.native): Unit

    Permalink

    The synchronous version of fs.writeFile().

    The synchronous version of fs.writeFile().

    returns

    undefined.

    Definition Classes
    Fs
    Example:
    1. fs.writeFileSync(file, data[, options])

  156. def writeSync(fd: FileDescriptor, data: String): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd.

    fd

    the given file descriptor

    data

    the given string

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, string[, position[, encoding]])
  157. def writeSync(fd: FileDescriptor, data: String, encoding: String): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd.

    fd

    the given file descriptor

    data

    the given string

    encoding

    is the expected string encoding.

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, string[, position[, encoding]])
  158. def writeSync(fd: FileDescriptor, data: String, position: Int): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd.

    fd

    the given file descriptor

    data

    the given string

    position

    refers to the offset from the beginning of the file where this data should be written.

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, string[, position[, encoding]])
  159. def writeSync(fd: FileDescriptor, data: String, position: Int, encoding: String): Unit

    Permalink

    Write string to the file specified by fd.

    Write string to the file specified by fd.

    fd

    the given file descriptor

    data

    the given string

    position

    refers to the offset from the beginning of the file where this data should be written.

    encoding

    is the expected string encoding.

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, string[, position[, encoding]])
  160. def writeSync(fd: FileDescriptor, buffer: |[Buffer, Uint8Array]): Unit

    Permalink

    Write buffer to the file specified by fd.

    Write buffer to the file specified by fd.

    fd

    the given file descriptor

    buffer

    the given buffer

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, buffer[, offset[, length[, position]]])
  161. def writeSync(fd: FileDescriptor, buffer: |[Buffer, Uint8Array], offset: Int = js.native, length: Int = js.native, position: Int = js.native): Unit

    Permalink

    Write buffer to the file specified by fd.

    Write buffer to the file specified by fd.

    fd

    the given file descriptor

    buffer

    the given buffer

    offset

    determines the part of the buffer to be written, and length is an integer specifying the number of bytes to write.

    length

    the optional length of the data to write

    position

    refers to the offset from the beginning of the file where this data should be written.

    Definition Classes
    Fs
    Example:
    1. fs.writeSync(fd, buffer[, offset[, length[, position]]])

Deprecated Value Members

  1. def exists(path: String, callback: Function1[Boolean, Any]): Unit

    Permalink

    Test whether or not the given path exists by checking with the file system.

    Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false.

    Definition Classes
    Fs
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) Use fs.stat() or fs.access() instead.

    Example:
    1. fs.exists('/etc/passwd', (exists) => { ... })

Inherited from Fs

Inherited from IEventEmitter

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped