@types/node 10.0.10 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. node/README.md +1 -1
  2. node/index.d.ts +407 -400
  3. node/package.json +2 -2
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped.git/tree/master/types/node
9
9
 
10
10
  Additional Details
11
- * Last updated: Tue, 15 May 2018 17:48:31 GMT
11
+ * Last updated: Tue, 15 May 2018 21:28:51 GMT
12
12
  * Dependencies: none
13
13
  * Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
14
14
 
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Node.js 10.0.x
1
+ // Type definitions for Node.js 10.1.x
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <http://typescriptlang.org>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
@@ -4663,482 +4663,481 @@ declare module "fs" {
4663
4663
  * @param flags An optional integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
4664
4664
  */
4665
4665
  export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
4666
- }
4667
4666
 
4668
- declare module "fs/promises" {
4669
- import { PathLike, Stats } from "fs";
4670
- interface FileHandle {
4671
- /**
4672
- * Gets the file descriptor for this file handle.
4673
- */
4674
- readonly fd: number;
4667
+ export namespace promises {
4668
+ interface FileHandle {
4669
+ /**
4670
+ * Gets the file descriptor for this file handle.
4671
+ */
4672
+ readonly fd: number;
4675
4673
 
4676
- /**
4677
- * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically.
4678
- * The `FileHandle` must have been opened for appending.
4679
- * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
4680
- * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
4681
- * If `encoding` is not supplied, the default of `'utf8'` is used.
4682
- * If `mode` is not supplied, the default of `0o666` is used.
4683
- * If `mode` is a string, it is parsed as an octal integer.
4684
- * If `flag` is not supplied, the default of `'a'` is used.
4685
- */
4686
- appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
4674
+ /**
4675
+ * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically.
4676
+ * The `FileHandle` must have been opened for appending.
4677
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
4678
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
4679
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
4680
+ * If `mode` is not supplied, the default of `0o666` is used.
4681
+ * If `mode` is a string, it is parsed as an octal integer.
4682
+ * If `flag` is not supplied, the default of `'a'` is used.
4683
+ */
4684
+ appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
4687
4685
 
4688
- /**
4689
- * Asynchronous fchown(2) - Change ownership of a file.
4690
- */
4691
- chown(uid: number, gid: number): Promise<void>;
4686
+ /**
4687
+ * Asynchronous fchown(2) - Change ownership of a file.
4688
+ */
4689
+ chown(uid: number, gid: number): Promise<void>;
4690
+
4691
+ /**
4692
+ * Asynchronous fchmod(2) - Change permissions of a file.
4693
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
4694
+ */
4695
+ chmod(mode: string | number): Promise<void>;
4696
+
4697
+ /**
4698
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4699
+ */
4700
+ datasync(): Promise<void>;
4701
+
4702
+ /**
4703
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
4704
+ */
4705
+ sync(): Promise<void>;
4706
+
4707
+ /**
4708
+ * Asynchronously reads data from the file.
4709
+ * The `FileHandle` must have been opened for reading.
4710
+ * @param buffer The buffer that the data will be written to.
4711
+ * @param offset The offset in the buffer at which to start writing.
4712
+ * @param length The number of bytes to read.
4713
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
4714
+ */
4715
+ read<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
4716
+
4717
+ /**
4718
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4719
+ * The `FileHandle` must have been opened for reading.
4720
+ * @param options An object that may contain an optional flag.
4721
+ * If a flag is not provided, it defaults to `'r'`.
4722
+ */
4723
+ readFile(options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
4724
+
4725
+ /**
4726
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4727
+ * The `FileHandle` must have been opened for reading.
4728
+ * @param options An object that may contain an optional flag.
4729
+ * If a flag is not provided, it defaults to `'r'`.
4730
+ */
4731
+ readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
4732
+
4733
+ /**
4734
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4735
+ * The `FileHandle` must have been opened for reading.
4736
+ * @param options An object that may contain an optional flag.
4737
+ * If a flag is not provided, it defaults to `'r'`.
4738
+ */
4739
+ readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
4740
+
4741
+ /**
4742
+ * Asynchronous fstat(2) - Get file status.
4743
+ */
4744
+ stat(): Promise<Stats>;
4745
+
4746
+ /**
4747
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
4748
+ * @param len If not specified, defaults to `0`.
4749
+ */
4750
+ truncate(len?: number): Promise<void>;
4751
+
4752
+ /**
4753
+ * Asynchronously change file timestamps of the file.
4754
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
4755
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
4756
+ */
4757
+ utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
4758
+
4759
+ /**
4760
+ * Asynchronously writes `buffer` to the file.
4761
+ * The `FileHandle` must have been opened for writing.
4762
+ * @param buffer The buffer that the data will be written to.
4763
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
4764
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
4765
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4766
+ */
4767
+ write<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
4768
+
4769
+ /**
4770
+ * Asynchronously writes `string` to the file.
4771
+ * The `FileHandle` must have been opened for writing.
4772
+ * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4773
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
4774
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4775
+ * @param encoding The expected string encoding.
4776
+ */
4777
+ write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
4778
+
4779
+ /**
4780
+ * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically.
4781
+ * The `FileHandle` must have been opened for writing.
4782
+ * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
4783
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
4784
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
4785
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
4786
+ * If `mode` is not supplied, the default of `0o666` is used.
4787
+ * If `mode` is a string, it is parsed as an octal integer.
4788
+ * If `flag` is not supplied, the default of `'w'` is used.
4789
+ */
4790
+ writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
4791
+
4792
+ /**
4793
+ * Asynchronous close(2) - close a `FileHandle`.
4794
+ */
4795
+ close(): Promise<void>;
4796
+ }
4692
4797
 
4693
4798
  /**
4694
- * Asynchronous fchmod(2) - Change permissions of a file.
4695
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
4799
+ * Asynchronously tests a user's permissions for the file specified by path.
4800
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
4801
+ * URL support is _experimental_.
4696
4802
  */
4697
- chmod(mode: string | number): Promise<void>;
4803
+ function access(path: PathLike, mode?: number): Promise<void>;
4698
4804
 
4699
4805
  /**
4700
- * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4806
+ * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists.
4807
+ * Node.js makes no guarantees about the atomicity of the copy operation.
4808
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4809
+ * to remove the destination.
4810
+ * @param src A path to the source file.
4811
+ * @param dest A path to the destination file.
4812
+ * @param flags An optional integer that specifies the behavior of the copy operation. The only
4813
+ * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if
4814
+ * `dest` already exists.
4701
4815
  */
4702
- datasync(): Promise<void>;
4816
+ function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise<void>;
4703
4817
 
4704
4818
  /**
4705
- * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
4819
+ * Asynchronous open(2) - open and possibly create a file.
4820
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4821
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not
4822
+ * supplied, defaults to `0o666`.
4706
4823
  */
4707
- sync(): Promise<void>;
4824
+ function open(path: PathLike, flags: string | number, mode?: string | number): Promise<FileHandle>;
4708
4825
 
4709
4826
  /**
4710
- * Asynchronously reads data from the file.
4711
- * The `FileHandle` must have been opened for reading.
4827
+ * Asynchronously reads data from the file referenced by the supplied `FileHandle`.
4828
+ * @param handle A `FileHandle`.
4712
4829
  * @param buffer The buffer that the data will be written to.
4713
4830
  * @param offset The offset in the buffer at which to start writing.
4714
4831
  * @param length The number of bytes to read.
4715
- * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
4832
+ * @param position The offset from the beginning of the file from which data should be read. If
4833
+ * `null`, data will be read from the current position.
4716
4834
  */
4717
- read<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
4835
+ function read<TBuffer extends Buffer | Uint8Array>(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
4718
4836
 
4719
4837
  /**
4720
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4721
- * The `FileHandle` must have been opened for reading.
4722
- * @param options An object that may contain an optional flag.
4723
- * If a flag is not provided, it defaults to `'r'`.
4838
+ * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`.
4839
+ * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4840
+ * @param handle A `FileHandle`.
4841
+ * @param buffer The buffer that the data will be written to.
4842
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
4843
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
4844
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4724
4845
  */
4725
- readFile(options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
4846
+ function write<TBuffer extends Buffer | Uint8Array>(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
4726
4847
 
4727
4848
  /**
4728
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4729
- * The `FileHandle` must have been opened for reading.
4730
- * @param options An object that may contain an optional flag.
4731
- * If a flag is not provided, it defaults to `'r'`.
4849
+ * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`.
4850
+ * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4851
+ * @param handle A `FileHandle`.
4852
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
4853
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4854
+ * @param encoding The expected string encoding.
4732
4855
  */
4733
- readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
4856
+ function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
4734
4857
 
4735
4858
  /**
4736
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
4737
- * The `FileHandle` must have been opened for reading.
4738
- * @param options An object that may contain an optional flag.
4739
- * If a flag is not provided, it defaults to `'r'`.
4859
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
4860
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4861
+ * URL support is _experimental_.
4862
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4863
+ * URL support is _experimental_.
4740
4864
  */
4741
- readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
4865
+ function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
4742
4866
 
4743
4867
  /**
4744
- * Asynchronous fstat(2) - Get file status.
4868
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
4869
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4870
+ * @param len If not specified, defaults to `0`.
4745
4871
  */
4746
- stat(): Promise<Stats>;
4872
+ function truncate(path: PathLike, len?: number): Promise<void>;
4747
4873
 
4748
4874
  /**
4749
4875
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
4876
+ * @param handle A `FileHandle`.
4750
4877
  * @param len If not specified, defaults to `0`.
4751
4878
  */
4752
- truncate(len?: number): Promise<void>;
4879
+ function ftruncate(handle: FileHandle, len?: number): Promise<void>;
4753
4880
 
4754
4881
  /**
4755
- * Asynchronously change file timestamps of the file.
4756
- * @param atime The last access time. If a string is provided, it will be coerced to number.
4757
- * @param mtime The last modified time. If a string is provided, it will be coerced to number.
4882
+ * Asynchronous rmdir(2) - delete a directory.
4883
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4758
4884
  */
4759
- utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
4885
+ function rmdir(path: PathLike): Promise<void>;
4760
4886
 
4761
4887
  /**
4762
- * Asynchronously writes `buffer` to the file.
4763
- * The `FileHandle` must have been opened for writing.
4764
- * @param buffer The buffer that the data will be written to.
4765
- * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
4766
- * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
4767
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4888
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4889
+ * @param handle A `FileHandle`.
4768
4890
  */
4769
- write<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
4891
+ function fdatasync(handle: FileHandle): Promise<void>;
4770
4892
 
4771
4893
  /**
4772
- * Asynchronously writes `string` to the file.
4773
- * The `FileHandle` must have been opened for writing.
4774
- * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4775
- * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
4776
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4777
- * @param encoding The expected string encoding.
4894
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
4895
+ * @param handle A `FileHandle`.
4778
4896
  */
4779
- write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
4897
+ function fsync(handle: FileHandle): Promise<void>;
4780
4898
 
4781
4899
  /**
4782
- * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically.
4783
- * The `FileHandle` must have been opened for writing.
4784
- * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
4785
- * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
4786
- * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
4787
- * If `encoding` is not supplied, the default of `'utf8'` is used.
4788
- * If `mode` is not supplied, the default of `0o666` is used.
4789
- * If `mode` is a string, it is parsed as an octal integer.
4790
- * If `flag` is not supplied, the default of `'w'` is used.
4900
+ * Asynchronous mkdir(2) - create a directory.
4901
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4902
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
4791
4903
  */
4792
- writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
4904
+ function mkdir(path: PathLike, mode?: string | number): Promise<void>;
4793
4905
 
4794
4906
  /**
4795
- * Asynchronous close(2) - close a `FileHandle`.
4907
+ * Asynchronous readdir(3) - read a directory.
4908
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4909
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4796
4910
  */
4797
- close(): Promise<void>;
4798
- }
4799
-
4800
- /**
4801
- * Asynchronously tests a user's permissions for the file specified by path.
4802
- * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
4803
- * URL support is _experimental_.
4804
- */
4805
- function access(path: PathLike, mode?: number): Promise<void>;
4911
+ function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string[]>;
4806
4912
 
4807
- /**
4808
- * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists.
4809
- * Node.js makes no guarantees about the atomicity of the copy operation.
4810
- * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4811
- * to remove the destination.
4812
- * @param src A path to the source file.
4813
- * @param dest A path to the destination file.
4814
- * @param flags An optional integer that specifies the behavior of the copy operation. The only
4815
- * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if
4816
- * `dest` already exists.
4817
- */
4818
- function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise<void>;
4819
-
4820
- /**
4821
- * Asynchronous open(2) - open and possibly create a file.
4822
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4823
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not
4824
- * supplied, defaults to `0o666`.
4825
- */
4826
- function open(path: PathLike, flags: string | number, mode?: string | number): Promise<FileHandle>;
4827
-
4828
- /**
4829
- * Asynchronously reads data from the file referenced by the supplied `FileHandle`.
4830
- * @param handle A `FileHandle`.
4831
- * @param buffer The buffer that the data will be written to.
4832
- * @param offset The offset in the buffer at which to start writing.
4833
- * @param length The number of bytes to read.
4834
- * @param position The offset from the beginning of the file from which data should be read. If
4835
- * `null`, data will be read from the current position.
4836
- */
4837
- function read<TBuffer extends Buffer | Uint8Array>(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
4838
-
4839
- /**
4840
- * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`.
4841
- * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4842
- * @param handle A `FileHandle`.
4843
- * @param buffer The buffer that the data will be written to.
4844
- * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
4845
- * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
4846
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4847
- */
4848
- function write<TBuffer extends Buffer | Uint8Array>(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
4849
-
4850
- /**
4851
- * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`.
4852
- * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
4853
- * @param handle A `FileHandle`.
4854
- * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
4855
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
4856
- * @param encoding The expected string encoding.
4857
- */
4858
- function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
4859
-
4860
- /**
4861
- * Asynchronous rename(2) - Change the name or location of a file or directory.
4862
- * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4863
- * URL support is _experimental_.
4864
- * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4865
- * URL support is _experimental_.
4866
- */
4867
- function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
4868
-
4869
- /**
4870
- * Asynchronous truncate(2) - Truncate a file to a specified length.
4871
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4872
- * @param len If not specified, defaults to `0`.
4873
- */
4874
- function truncate(path: PathLike, len?: number): Promise<void>;
4875
-
4876
- /**
4877
- * Asynchronous ftruncate(2) - Truncate a file to a specified length.
4878
- * @param handle A `FileHandle`.
4879
- * @param len If not specified, defaults to `0`.
4880
- */
4881
- function ftruncate(handle: FileHandle, len?: number): Promise<void>;
4882
-
4883
- /**
4884
- * Asynchronous rmdir(2) - delete a directory.
4885
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4886
- */
4887
- function rmdir(path: PathLike): Promise<void>;
4888
-
4889
- /**
4890
- * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4891
- * @param handle A `FileHandle`.
4892
- */
4893
- function fdatasync(handle: FileHandle): Promise<void>;
4894
-
4895
- /**
4896
- * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
4897
- * @param handle A `FileHandle`.
4898
- */
4899
- function fsync(handle: FileHandle): Promise<void>;
4900
-
4901
- /**
4902
- * Asynchronous mkdir(2) - create a directory.
4903
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4904
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
4905
- */
4906
- function mkdir(path: PathLike, mode?: string | number): Promise<void>;
4907
-
4908
- /**
4909
- * Asynchronous readdir(3) - read a directory.
4910
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4911
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4912
- */
4913
- function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string[]>;
4914
-
4915
- /**
4916
- * Asynchronous readdir(3) - read a directory.
4917
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4918
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4919
- */
4920
- function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer[]>;
4921
-
4922
- /**
4923
- * Asynchronous readdir(3) - read a directory.
4924
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4925
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4926
- */
4927
- function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string[] | Buffer[]>;
4913
+ /**
4914
+ * Asynchronous readdir(3) - read a directory.
4915
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4916
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4917
+ */
4918
+ function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer[]>;
4928
4919
 
4929
- /**
4930
- * Asynchronous readlink(2) - read value of a symbolic link.
4931
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4932
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4933
- */
4934
- function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
4920
+ /**
4921
+ * Asynchronous readdir(3) - read a directory.
4922
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4923
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4924
+ */
4925
+ function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string[] | Buffer[]>;
4935
4926
 
4936
- /**
4937
- * Asynchronous readlink(2) - read value of a symbolic link.
4938
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4939
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4940
- */
4941
- function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
4927
+ /**
4928
+ * Asynchronous readlink(2) - read value of a symbolic link.
4929
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4930
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4931
+ */
4932
+ function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
4942
4933
 
4943
- /**
4944
- * Asynchronous readlink(2) - read value of a symbolic link.
4945
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4946
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4947
- */
4948
- function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
4934
+ /**
4935
+ * Asynchronous readlink(2) - read value of a symbolic link.
4936
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4937
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4938
+ */
4939
+ function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
4949
4940
 
4950
- /**
4951
- * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
4952
- * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
4953
- * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
4954
- * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
4955
- * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
4956
- */
4957
- function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
4941
+ /**
4942
+ * Asynchronous readlink(2) - read value of a symbolic link.
4943
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4944
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
4945
+ */
4946
+ function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
4958
4947
 
4959
- /**
4960
- * Asynchronous fstat(2) - Get file status.
4961
- * @param handle A `FileHandle`.
4962
- */
4963
- function fstat(handle: FileHandle): Promise<Stats>;
4948
+ /**
4949
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
4950
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
4951
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
4952
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
4953
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
4954
+ */
4955
+ function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
4964
4956
 
4965
- /**
4966
- * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
4967
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4968
- */
4969
- function lstat(path: PathLike): Promise<Stats>;
4957
+ /**
4958
+ * Asynchronous fstat(2) - Get file status.
4959
+ * @param handle A `FileHandle`.
4960
+ */
4961
+ function fstat(handle: FileHandle): Promise<Stats>;
4970
4962
 
4971
- /**
4972
- * Asynchronous stat(2) - Get file status.
4973
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4974
- */
4975
- function stat(path: PathLike): Promise<Stats>;
4963
+ /**
4964
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
4965
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4966
+ */
4967
+ function lstat(path: PathLike): Promise<Stats>;
4976
4968
 
4977
- /**
4978
- * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
4979
- * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4980
- * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4981
- */
4982
- function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
4969
+ /**
4970
+ * Asynchronous stat(2) - Get file status.
4971
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4972
+ */
4973
+ function stat(path: PathLike): Promise<Stats>;
4983
4974
 
4984
- /**
4985
- * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
4986
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4987
- */
4988
- function unlink(path: PathLike): Promise<void>;
4975
+ /**
4976
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
4977
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4978
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
4979
+ */
4980
+ function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
4989
4981
 
4990
- /**
4991
- * Asynchronous fchmod(2) - Change permissions of a file.
4992
- * @param handle A `FileHandle`.
4993
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
4994
- */
4995
- function fchmod(handle: FileHandle, mode: string | number): Promise<void>;
4982
+ /**
4983
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
4984
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4985
+ */
4986
+ function unlink(path: PathLike): Promise<void>;
4996
4987
 
4997
- /**
4998
- * Asynchronous chmod(2) - Change permissions of a file.
4999
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5000
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
5001
- */
5002
- function chmod(path: PathLike, mode: string | number): Promise<void>;
4988
+ /**
4989
+ * Asynchronous fchmod(2) - Change permissions of a file.
4990
+ * @param handle A `FileHandle`.
4991
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
4992
+ */
4993
+ function fchmod(handle: FileHandle, mode: string | number): Promise<void>;
5003
4994
 
5004
- /**
5005
- * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
5006
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5007
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
5008
- */
5009
- function lchmod(path: PathLike, mode: string | number): Promise<void>;
4995
+ /**
4996
+ * Asynchronous chmod(2) - Change permissions of a file.
4997
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
4998
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
4999
+ */
5000
+ function chmod(path: PathLike, mode: string | number): Promise<void>;
5010
5001
 
5011
- /**
5012
- * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
5013
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5014
- */
5015
- function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
5002
+ /**
5003
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
5004
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5005
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
5006
+ */
5007
+ function lchmod(path: PathLike, mode: string | number): Promise<void>;
5016
5008
 
5017
- /**
5018
- * Asynchronous fchown(2) - Change ownership of a file.
5019
- * @param handle A `FileHandle`.
5020
- */
5021
- function fchown(handle: FileHandle, uid: number, gid: number): Promise<void>;
5009
+ /**
5010
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
5011
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5012
+ */
5013
+ function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
5022
5014
 
5023
- /**
5024
- * Asynchronous chown(2) - Change ownership of a file.
5025
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5026
- */
5027
- function chown(path: PathLike, uid: number, gid: number): Promise<void>;
5015
+ /**
5016
+ * Asynchronous fchown(2) - Change ownership of a file.
5017
+ * @param handle A `FileHandle`.
5018
+ */
5019
+ function fchown(handle: FileHandle, uid: number, gid: number): Promise<void>;
5028
5020
 
5029
- /**
5030
- * Asynchronously change file timestamps of the file referenced by the supplied path.
5031
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5032
- * @param atime The last access time. If a string is provided, it will be coerced to number.
5033
- * @param mtime The last modified time. If a string is provided, it will be coerced to number.
5034
- */
5035
- function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
5021
+ /**
5022
+ * Asynchronous chown(2) - Change ownership of a file.
5023
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5024
+ */
5025
+ function chown(path: PathLike, uid: number, gid: number): Promise<void>;
5036
5026
 
5037
- /**
5038
- * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`.
5039
- * @param handle A `FileHandle`.
5040
- * @param atime The last access time. If a string is provided, it will be coerced to number.
5041
- * @param mtime The last modified time. If a string is provided, it will be coerced to number.
5042
- */
5043
- function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
5027
+ /**
5028
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
5029
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5030
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
5031
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
5032
+ */
5033
+ function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
5044
5034
 
5045
- /**
5046
- * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5047
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5048
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5049
- */
5050
- function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
5035
+ /**
5036
+ * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`.
5037
+ * @param handle A `FileHandle`.
5038
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
5039
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
5040
+ */
5041
+ function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
5051
5042
 
5052
- /**
5053
- * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5054
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5055
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5056
- */
5057
- function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
5043
+ /**
5044
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5045
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5046
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5047
+ */
5048
+ function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
5058
5049
 
5059
- /**
5060
- * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5061
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5062
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5063
- */
5064
- function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
5050
+ /**
5051
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5052
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5053
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5054
+ */
5055
+ function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
5065
5056
 
5066
- /**
5067
- * Asynchronously creates a unique temporary directory.
5068
- * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5069
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5070
- */
5071
- function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
5057
+ /**
5058
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
5059
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5060
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5061
+ */
5062
+ function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
5072
5063
 
5073
- /**
5074
- * Asynchronously creates a unique temporary directory.
5075
- * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5076
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5077
- */
5078
- function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
5064
+ /**
5065
+ * Asynchronously creates a unique temporary directory.
5066
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5067
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5068
+ */
5069
+ function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
5079
5070
 
5080
- /**
5081
- * Asynchronously creates a unique temporary directory.
5082
- * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5083
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5084
- */
5085
- function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
5071
+ /**
5072
+ * Asynchronously creates a unique temporary directory.
5073
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5074
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5075
+ */
5076
+ function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
5086
5077
 
5087
- /**
5088
- * Asynchronously writes data to a file, replacing the file if it already exists.
5089
- * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
5090
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5091
- * URL support is _experimental_.
5092
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5093
- * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
5094
- * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
5095
- * If `encoding` is not supplied, the default of `'utf8'` is used.
5096
- * If `mode` is not supplied, the default of `0o666` is used.
5097
- * If `mode` is a string, it is parsed as an octal integer.
5098
- * If `flag` is not supplied, the default of `'w'` is used.
5099
- */
5100
- function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
5078
+ /**
5079
+ * Asynchronously creates a unique temporary directory.
5080
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
5081
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
5082
+ */
5083
+ function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
5101
5084
 
5102
- /**
5103
- * Asynchronously append data to a file, creating the file if it does not exist.
5104
- * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
5105
- * URL support is _experimental_.
5106
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5107
- * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
5108
- * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
5109
- * If `encoding` is not supplied, the default of `'utf8'` is used.
5110
- * If `mode` is not supplied, the default of `0o666` is used.
5111
- * If `mode` is a string, it is parsed as an octal integer.
5112
- * If `flag` is not supplied, the default of `'a'` is used.
5113
- */
5114
- function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
5085
+ /**
5086
+ * Asynchronously writes data to a file, replacing the file if it already exists.
5087
+ * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
5088
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5089
+ * URL support is _experimental_.
5090
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5091
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
5092
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
5093
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
5094
+ * If `mode` is not supplied, the default of `0o666` is used.
5095
+ * If `mode` is a string, it is parsed as an octal integer.
5096
+ * If `flag` is not supplied, the default of `'w'` is used.
5097
+ */
5098
+ function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
5115
5099
 
5116
- /**
5117
- * Asynchronously reads the entire contents of a file.
5118
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5119
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5120
- * @param options An object that may contain an optional flag.
5121
- * If a flag is not provided, it defaults to `'r'`.
5122
- */
5123
- function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
5100
+ /**
5101
+ * Asynchronously append data to a file, creating the file if it does not exist.
5102
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
5103
+ * URL support is _experimental_.
5104
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5105
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
5106
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
5107
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
5108
+ * If `mode` is not supplied, the default of `0o666` is used.
5109
+ * If `mode` is a string, it is parsed as an octal integer.
5110
+ * If `flag` is not supplied, the default of `'a'` is used.
5111
+ */
5112
+ function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
5124
5113
 
5125
- /**
5126
- * Asynchronously reads the entire contents of a file.
5127
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5128
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5129
- * @param options An object that may contain an optional flag.
5130
- * If a flag is not provided, it defaults to `'r'`.
5131
- */
5132
- function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
5114
+ /**
5115
+ * Asynchronously reads the entire contents of a file.
5116
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5117
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5118
+ * @param options An object that may contain an optional flag.
5119
+ * If a flag is not provided, it defaults to `'r'`.
5120
+ */
5121
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
5133
5122
 
5134
- /**
5135
- * Asynchronously reads the entire contents of a file.
5136
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5137
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5138
- * @param options An object that may contain an optional flag.
5139
- * If a flag is not provided, it defaults to `'r'`.
5140
- */
5141
- function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
5123
+ /**
5124
+ * Asynchronously reads the entire contents of a file.
5125
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5126
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5127
+ * @param options An object that may contain an optional flag.
5128
+ * If a flag is not provided, it defaults to `'r'`.
5129
+ */
5130
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
5131
+
5132
+ /**
5133
+ * Asynchronously reads the entire contents of a file.
5134
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
5135
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
5136
+ * @param options An object that may contain an optional flag.
5137
+ * If a flag is not provided, it defaults to `'r'`.
5138
+ */
5139
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
5140
+ }
5142
5141
  }
5143
5142
 
5144
5143
  declare module "path" {
@@ -6836,8 +6835,16 @@ declare module "http2" {
6836
6835
  import * as tls from "tls";
6837
6836
  import * as url from "url";
6838
6837
 
6839
- import { IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
6840
- export { IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
6838
+ import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
6839
+ export { OutgoingHttpHeaders } from "http";
6840
+
6841
+ export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
6842
+ ':path'?: string;
6843
+ ':method'?: string;
6844
+ ':status'?: string;
6845
+ ':authority'?: string;
6846
+ ':scheme'?: string;
6847
+ }
6841
6848
 
6842
6849
  // Http2Stream
6843
6850
 
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "10.0.10",
3
+ "version": "10.1.0",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -130,6 +130,6 @@
130
130
  },
131
131
  "scripts": {},
132
132
  "dependencies": {},
133
- "typesPublisherContentHash": "0d423a8a716f7d54d50947d46a073470f3e01e4d7c0755bddc359932a2704efe",
133
+ "typesPublisherContentHash": "b9a6e57a599c96f9ff1bfbd55b43a19ab3014cecce163fe4a2febef277f03de2",
134
134
  "typeScriptVersion": "2.0"
135
135
  }