fs¶
-
uv.fs.close(fd)¶ See the manpages for close(2)
Arguments: - fd (int) – A file descriptor that is open.
Throws: If unable to close the file descriptor/the file descriptor does not exist.
-
uv.fs.open(path, flags, callback)¶ See the manpages for open(2)
Arguments: - path (string) – The path to the file. May be relative to the current working directory.
- flags (string) – Flags to open the file with.
- callback (function(fd)) – The callback that will recieve the file descriptor of the newly opened file.
-
uv.fs.read(fd, size, offset, callback)¶ See the manpages for preadv(2)
Arguments: - fd (int) – The opened file-descriptor.
- size (int) – The amount of bytes to read from the file.
- offset (int) – The offset to read from.
- callback (function(ArrayBuffer)) – The callback function which will take an
ArrayBufferas it’s first argument.
-
uv.fs.unlink(fd, callback)¶ See the manpages for unlink(2)
Arguments: - fd (int) – The opened file-descriptor
- callback (function(bool)) – A callback that will accept a boolean as it’s first argument, indicating the status of the request.
-
uv.fs.write(fd, array, offset, callback)¶ See the manpages for pwritev(2)
Arguments: - fd (int) – The opened file-descriptor.
- array (Uint8Array) – The bytes to write out to the file.
- offset (int) – The offset for writing to the file.
- callback (function(bool)) – A callback that will accept a boolean as it’s first argument, indicating the status of the request.
-
uv.fs.mkdir(path, callback)¶ See the manpages for mkdir(2)
Arguments: - path (string) – The path to create.
- callback (function(bool)) – The callback which will recieve the status of the request.
-
uv.fs.mkdtemp(path, callback)¶ See the manpages for mkdtemp(3)
-
uv.fs.scandir(path, callback)¶ See the manpages for scandir(3)
After this function finishes execution, the callback will recieve a function which you can repeatedly call to get the next file.
-
uv.fs.fdatasync(fd, callback)¶ See the manpages for fdatasync(2)
-
uv.fs.ftruncate(fd, offset, callback)¶ See the manpages for ftruncate(2)
-
uv.fs.sendfile(fd, out_fd, offset, length, callback)¶ See the manpages for sendfile(2)
-
uv.fs.symlink(path, new_path, flags, callback)¶ See the manpages for symlink(2)
-
uv.fs.readlink(path, callback)¶ See the manpages for readlink(2)