{"_id":"async-file","_rev":"13-5741b37947c878b11d9fe375251fd27b","name":"async-file","dist-tags":{"latest":"2.0.2"},"versions":{"1.0.0":{"name":"async-file","version":"1.0.0","keywords":["async","await","typescript","promise","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@1.0.0","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"9c06b6456dc83123bf199a66db0ff11a75512d77","tarball":"https://registry.npmjs.org/async-file/-/async-file-1.0.0.tgz","integrity":"sha512-Rr38XCAHtTmEVK9XQvwZP6jG3yjmb1qDulUrH0tvEALE110763fe5YwLMOzdkyNSYKJ/jUTfNP4WcBsB2Am26w==","signatures":[{"sig":"MEYCIQC5wWkZH0/MCcfdN8pXq2RC+kC9WACXEZx/wFvEP6tFCQIhAOjEEctYu39VPOxPwwVjusxIH6nVT7eY5css7fEsoz53","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"9c06b6456dc83123bf199a66db0ff11a75512d77","gitHead":"0f320af7ca897b13d25fdf185c9f122a9feb6182","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"2.14.12","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"4.2.4","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-1.0.0.tgz_1455001787514_0.20561181474477053","host":"packages-9-west.internal.npmjs.com"},"directories":{}},"1.0.1":{"name":"async-file","version":"1.0.1","keywords":["async","await","typescript","promise","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@1.0.1","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"cb11aa77238a849e46341d10722a0b3bef70a94c","tarball":"https://registry.npmjs.org/async-file/-/async-file-1.0.1.tgz","integrity":"sha512-XPOVZmcI7iGlT0KjdiEn43r+EK5IORtLM9hGKJ3dAvzhAyRqTLqgONZXir5D+MA5KB9CrHuDMxfwcq/NhA9QcA==","signatures":[{"sig":"MEUCIESGKrFPuYbphEQF81FxJyPklq+e77APYWShoerV0GMfAiEA+QUrAxO8BMKpm00lJvXtsz/B7/nIcMgDXzSqwMpdQ9s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"cb11aa77238a849e46341d10722a0b3bef70a94c","gitHead":"85afa2588e7260e07ea76857ae779ffd7976b999","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"2.14.12","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"4.2.4","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-1.0.1.tgz_1456031859265_0.20865219156257808","host":"packages-6-west.internal.npmjs.com"},"directories":{}},"1.0.2":{"name":"async-file","version":"1.0.2","keywords":["async","await","typescript","promise","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@1.0.2","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"de2bd168517e069340e7d5f75dd126e7c712b529","tarball":"https://registry.npmjs.org/async-file/-/async-file-1.0.2.tgz","integrity":"sha512-OhHWf+YlVX181zj+UXr8hikdvKGAtPrchQJzliWlqIk8rnoASgwxXnUqsQnM+ysVif7i5Clof5RJ134DN3i/vg==","signatures":[{"sig":"MEUCICrJ/CWkGBem7aDaH6Tem7Zp4vmy+MAikALkzZ+/yCgHAiEAmSxPTs0CFDH5dOhmsZ/+/M06ZjOoHwahIicoVHyEIHE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"de2bd168517e069340e7d5f75dd126e7c712b529","gitHead":"37e0543b4c2c6ce6455f35f12c7cc4ac916d301b","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"2.14.12","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"4.2.4","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-1.0.2.tgz_1456032386892_0.2192018600180745","host":"packages-5-east.internal.npmjs.com"},"directories":{}},"2.0.0":{"name":"async-file","version":"2.0.0","keywords":["async","await","typescript","promise","promisify","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@2.0.0","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"4079cad728a00a348a2c14cdf9dac52b32721d26","tarball":"https://registry.npmjs.org/async-file/-/async-file-2.0.0.tgz","integrity":"sha512-zs1AI4VtEoHdJD1GSbwiKk6mzP9QiHemILU/+vQzaHJNaWYCW8PNqiN52o0M1Mvx47hNTSrWLI3m0V3bj+17pA==","signatures":[{"sig":"MEYCIQDRNVoCEoz88YJ4VXP9bH8ZzQLCJBfznKNvQ6kzwYULGwIhAMhN31eLUyHdh+ofJTU/sH36nu6NEw0BWmPNtn5yqmwV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"4079cad728a00a348a2c14cdf9dac52b32721d26","gitHead":"f1523cc905076a345040eefeacc31b42eae266c6","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"2.14.12","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"4.2.4","dependencies":{"rimraf":"^2.5.2"},"devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-2.0.0.tgz_1461537747172_0.1181962110567838","host":"packages-12-west.internal.npmjs.com"},"directories":{}},"2.0.1":{"name":"async-file","version":"2.0.1","keywords":["async","await","typescript","promise","promisify","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@2.0.1","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"67c7f3414d4d76831fa03786bcaac9ee4d22616f","tarball":"https://registry.npmjs.org/async-file/-/async-file-2.0.1.tgz","integrity":"sha512-Ew9AW4kEajxGXnFbOt79/0ut15D/ZiXijunqq84mhSXCxJQvSH1sEBRcKsYWnxcweq3+31WHYikWPaKmwUdlfA==","signatures":[{"sig":"MEQCIFVX3fw8A9e/8AcDzuyDG1ByR43aAIJZmXW1UMthvxjmAiAZlM0mBNJNpQXyNq12uTfSbrmVBeVAcrCS/C4ksPdeJw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"67c7f3414d4d76831fa03786bcaac9ee4d22616f","gitHead":"2020ec11a941be0283e6bde59ca25c80b14fb30d","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"3.10.6","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"4.5.0","dependencies":{"rimraf":"^2.5.2"},"devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-2.0.1.tgz_1473308374319_0.9979381286539137","host":"packages-16-east.internal.npmjs.com"},"directories":{}},"2.0.2":{"name":"async-file","version":"2.0.2","keywords":["async","await","typescript","promise","promisify","file","fs"],"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","_id":"async-file@2.0.2","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"homepage":"https://github.com/davetemplin/async-file#readme","bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"dist":{"shasum":"02ad07856ac3717e836b20aec5a4cfe00c46df23","tarball":"https://registry.npmjs.org/async-file/-/async-file-2.0.2.tgz","integrity":"sha512-oVmpzk0eaqZ022vPnkYHS/GaZO0y1B2DwB6rInNYg/1Rc+2hs0oUushzYFkizUyDpBY0PbEJ/RoCkJyAbrNluw==","signatures":[{"sig":"MEQCIERzcHab2DMyZeFuG6ifsj6OpvYziGJHb82Sv1dIkkJCAiB+r9tZ8p0KgwDypBeLq9ZzMlYBlCKEfuTyugTOr9JRgQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"02ad07856ac3717e836b20aec5a4cfe00c46df23","gitHead":"79e71eaca9d236963d354eec4b7a71755142f140","scripts":{"test":"mocha"},"_npmUser":{"name":"davetemplin","email":"davetemplin@hotmail.com"},"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"_npmVersion":"3.9.3","description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","_nodeVersion":"6.2.1","dependencies":{"rimraf":"^2.5.2"},"devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"_npmOperationalInternal":{"tmp":"tmp/async-file-2.0.2.tgz_1475469185169_0.7167701923754066","host":"packages-16-east.internal.npmjs.com"},"directories":{}}},"time":{"created":"2016-02-09T07:09:48.617Z","modified":"2026-06-04T13:18:22.806Z","1.0.0":"2016-02-09T07:09:48.617Z","1.0.1":"2016-02-21T05:17:42.235Z","1.0.2":"2016-02-21T05:26:31.362Z","2.0.0":"2016-04-24T22:42:27.690Z","2.0.1":"2016-09-08T04:19:36.398Z","2.0.2":"2016-10-03T04:33:07.692Z"},"bugs":{"url":"https://github.com/davetemplin/async-file/issues"},"author":{"url":"https://github.com/davetemplin/","name":"Dave Templin","email":"davetemplin@hotmail.com"},"license":"MIT","homepage":"https://github.com/davetemplin/async-file#readme","keywords":["async","await","typescript","promise","promisify","file","fs"],"repository":{"url":"git+https://github.com/davetemplin/async-file.git","type":"git"},"description":"Adapts the Node.js File System API (fs) for use with TypeScript async/await","maintainers":[{"name":"davetemplin","email":"davetemplin@hotmail.com"}],"readme":"# async-file\r\nAdapts the Node.js File System API (fs) for use with TypeScript async/await\r\n\r\nThis package makes it easier to access the Node.js file system using [TypeScript](http://www.typescriptlang.org/) and [async/await](https://blogs.msdn.microsoft.com/typescript/2015/11/03/what-about-asyncawait/).\r\nIt wraps the [Node.js File System API](https://nodejs.org/api/fs.html), replacing callback functions with functions that return a Promise.\r\n\r\nBasically it lets you write your code like this...\r\n```js\r\nawait fs.unlink('/tmp/hello');\r\nconsole.log('successfully deleted /tmp/hello');\r\n```\r\ninstead of like this...\r\n```js\r\nfs.unlink('/tmp/hello', err => {\r\n  if (err) throw err;\r\n  console.log('successfully deleted /tmp/hello');\r\n});\r\n```\r\n\r\n\r\nOr like this...\r\n```js\r\nawait fs.rename('/tmp/hello', '/tmp/world');\r\nvar stats = await fs.stat('/tmp/hello', '/tmp/world');\r\nconsole.log(`stats: ${JSON.stringify(stats)}`);\r\n```\r\ninstead of this...\r\n```js\r\nfs.rename('/tmp/hello', '/tmp/world', (err) => {\r\n  if (err) throw err;\r\n  fs.stat('/tmp/world', (err, stats) => {\r\n    if (err) throw err;\r\n    console.log(`stats: ${JSON.stringify(stats)}`);\r\n  });\r\n});\r\n```\r\n\r\nThis package is a drop-in replacement for ```fs``` typings in [node.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts)—simply import ```async-file``` instead of fs and call any method within an async function... \r\n\r\n```js\r\nimport * as fs from 'async-file';\r\n(async function () {\r\n    var data = await fs.readFile('data.csv', 'utf8');\r\n    await fs.rename('/tmp/hello', '/tmp/world');\r\n    await fs.access('/etc/passd', fs.constants.R_OK | fs.constants.W_OK);\r\n    await fs.appendFile('message.txt', 'data to append');\r\n    await fs.unlink('/tmp/hello');\r\n})();\r\n```\r\n\r\nIn addition several convenience functions are introduced to simplify accessing text-files, testing for file existance, and creating or deleting files and directories recursively.\r\nOther than the modified async function signatures and added convenience functions, the interface of this wrapper is virtually identical to the native Node.js file system library.\r\n\r\n\r\n## Getting Started\r\n\r\nMake sure you're running Node v4 and TypeScript 1.8 or higher...\r\n```\r\n$ node -v\r\nv4.2.6\r\n$ npm install -g typescript\r\n$ npm install -g tsd\r\n$ tsc -v\r\nVersion 1.8.9\r\n```\r\n\r\nInstall ```async-file``` package and required ```node.d.ts``` dependencies...\r\n```\r\n$ npm install async-file\r\n$ tsd install node\r\n```\r\n\r\nWrite some code...\r\n```js\r\nimport * as fs from 'async-file';\r\n(async function () {\r\n    var list = await fs.readdir('.');\r\n    console.log(list);    \r\n})();\r\n```\r\n\r\nSave the above to a file (index.ts), build and run it!\r\n```\r\n$ tsc index.ts typings/node/node.d.ts --target es6 --module commonjs \r\n$ node index.js\r\n[ 'index.js', 'index.ts', 'node_modules', 'typings' ]\r\n```\r\n\r\n## Wrapped Functions\r\nThe following is a list of all wrapped functions...\r\n\r\n* [```fs.access(path: string, mode?: number|string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback)\r\n* [```fs.appendFile(file: string|number, data: any, options?: { encoding?: string; mode?: number|string; flag?: string; }): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_appendfile_file_data_options_callback)\r\n* [```fs.chmod(path: string, mode: number|string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_chmod_path_mode_callback)\r\n* [```fs.chown(path: string, uid: number, gid: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_chown_path_uid_gid_callback)\r\n* [```fs.close(fd: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_close_fd_callback)\r\n* [```fs.fchmod(fd: number, mode: number|string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_fchmod_fd_mode_callback)\r\n* [```fs.fchown(fd: number, uid: number, gid: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_fchown_fd_uid_gid_callback)\r\n* [```fs.fstat(fd: number): Promise<Stats>```](https://nodejs.org/api/fs.html#fs_fs_fstat_fd_callback)\r\n* [```fs.fsync(fd: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_fsync_fd_callback)\r\n* [```fs.ftruncate(fd: number, len?: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_ftruncate_fd_len_callback)\r\n* [```fs.futimes(fd: number, atime: Date|number, mtime: Date|number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_futimes_fd_atime_mtime_callback)\r\n* [```fs.lchmod(path: string, mode: number|string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_lchmod_path_mode_callback)\r\n* [```fs.lchown(path: string, uid: number, gid: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_lchown_path_uid_gid_callback)\r\n* [```fs.link(srcpath: string, dstpath: string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_link_srcpath_dstpath_callback)\r\n* [```fs.lstat(path: string): Promise<Stats>```](https://nodejs.org/api/fs.html#fs_fs_lstat_path_callback)\r\n* [```fs.mkdir(path: string, mode?: number|string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_mkdir_path_mode_callback)\r\n* [```fs.mkdtemp(prefix: string): Promise<string>```](https://nodejs.org/api/fs.html#fs_fs_mkdtemp_prefix_callback)\r\n* [```fs.open(path: string, flags: string, mode?: number|string): Promise<number>```](https://nodejs.org/api/fs.html#fs_fs_open_path_flags_mode_callback)\r\n* [```fs.read(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<ReadResult>```](https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback)\r\n* [```fs.readdir(path: string): Promise<string[]>```](https://nodejs.org/api/fs.html#fs_fs_readdir_path_callback)\r\n* [```fs.readFile(file: string|number, options?: {encoding?: string, flag?: string}|string): Promise<any>```](https://nodejs.org/api/fs.html#fs_fs_readfile_file_options_callback)\r\n* [```fs.readlink(path: string): Promise<string>```](https://nodejs.org/api/fs.html#fs_fs_readlink_path_callback)\r\n* [```fs.realpath(path: string, cache?: {[path: string]: string}): Promise<string>```](https://nodejs.org/api/fs.html#fs_fs_realpath_path_cache_callback)\r\n* [```fs.rename(oldPath: string, newPath: string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback)\r\n* [```fs.rmdir(path: string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_rmdir_path_callback)\r\n* [```fs.stat(path: string): Promise<Stats>```](https://nodejs.org/api/fs.html#fs_fs_stat_path_callback)\r\n* [```fs.symlink(srcpath: string, dstpath: string, type?: string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_symlink_target_path_type_callback)\r\n* [```fs.truncate(path: string, len?: number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_truncate_path_len_callback)\r\n* [```fs.unlink(path: string): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback)\r\n* [```fs.utimes(path: string, atime: Date|number, mtime: Date|number): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_utimes_path_atime_mtime_callback)\r\n* [```fs.write(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise<{written: number; buffer: Buffer}>```](https://nodejs.org/api/fs.html#fs_fs_write_fd_data_position_encoding_callback)\r\n* [```fs.write(fd: number, data: any, offset?: number, position?: number, encoding?: string): Promise<{written: number; buffer: Buffer}>```](https://nodejs.org/api/fs.html#fs_fs_write_fd_data_position_encoding_callback)\r\n* [```fs.write(fd: number): Promise<{written: number; buffer: Buffer}>```](https://nodejs.org/api/fs.html#fs_fs_write_fd_data_position_encoding_callback)\r\n* [```fs.writeFile(file: string|number, data: string|any, options?: {encoding?: string, flag?: string, mode?: number|string}): Promise<void>```](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)\r\n\r\n## Convenience Functions\r\nIn addition to the wrapped functions above, the following convenience functions are provided...\r\n\r\n* ```fs.createDirectory(path, mode?: number|string): Promise<void>```\r\n* ```fs.delete(path: string): Promise<void>```\r\n* ```fs.exists(path: string): Promise<boolean>```\r\n* ```fs.readTextFile(file: string|number, encoding?: string, flags?: string): Promise<string>```\r\n* ```fs.writeTextFile(file: string|number, data: string, encoding?: string, mode?: string): Promise<void>```\r\n* ```fs.mkdirp(path: string): Promise<void>```\r\n* ```fs.rimraf(path: string): Promise<void>```\r\n\r\n```fs.createDirectory``` creates a directory recursively *(like [mkdirp](https://www.npmjs.com/package/mkdirp))*.\r\n\r\n```fs.delete``` deletes any file or directory, performing a deep delete on non-empty directories *(wraps [rimraf](https://www.npmjs.com/package/rimraf))*.\r\n\r\n```fs.exists``` implements the recommended solution of opening the file and returning ```true``` when the ```ENOENT``` error results.\r\n \r\n```fs.readTextFile``` and ```fs.writeTextFile``` are optimized for simple text-file access, dealing exclusively with strings not buffers or streaming.\r\n\r\n```fs.mkdirp``` and ```fs.rimraf``` are aliases for ```fs.createDirectory``` and ```fs.delete``` respectively, for those prefering more esoteric nomenclature.\r\n\r\n### Convenience Function Examples\r\n\r\nRead a series of three text files, one at a time...\r\n```js\r\nvar data1 = await fs.readTextFile('data1.csv');\r\nvar data2 = await fs.readTextFile('data2.csv');\r\nvar data3 = await fs.readTextFile('data3.csv');\r\n```\r\n\r\nAppend a line into an arbitrary series of text files...\r\n```js\r\nvar files = ['data1.log', 'data2.log', 'data3.log'];\r\nfor (var file of files)\r\n    await fs.writeTextFile(file, '\\nPASSED!\\n', null, 'a');\r\n```\r\n\r\nCheck for the existance of a file...\r\n```js\r\nif (!(await fs.exists('config.json')))\r\n    console.warn('Configuration file not found');\r\n```\r\n\r\nCreate a directory...\r\n```js\r\nawait fs.createDirectory('/tmp/path/to/file');\r\n```\r\n\r\nDelete a file or or directory...\r\n```js\r\nawait fs.delete('/tmp/path/to/file');\r\n```\r\n\r\n\r\n## Additional Notes\r\n\r\nIf access to both the native Node.js file system library and the wrapper is required at the same time *(e.g. to mix callbacks alongside async/await code)*, specify a different name in the import statement of the wrapper...\r\n```js\r\nimport * as fs from 'fs';\r\nimport * as afs from 'async-file';\r\nawait afs.rename('/tmp/hello', '/tmp/world');\r\nfs.unlink('/tmp/hello', err => \r\n  console.log('/tmp/hello deleted', err));\r\n});\r\n```\r\n\r\nBy design none of *\"sync\"* functions are exposed by the wrapper: fs.readFileSync, fs.writeFileSync, etc.\r\n\r\n## Related Wrappers\r\nHere are some other TypeScript async/await wrappers you may find useful...\r\n\r\n* [**async-parallel**](https://www.npmjs.com/package/async-parallel) simplifies invoking tasks in parallel\r\n* [**web-request**](https://www.npmjs.com/package/web-request) simplifies making web requests\r\n","readmeFilename":"README.md","users":{"ctaggart":true,"davetemplin":true}}