async-file-tried 1.0.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.
- package/.github/workflows/coveralls.yml +26 -0
- package/.github/workflows/node.js.yml +30 -0
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +417 -0
- package/dist/index.js.map +1 -0
- package/index.ts +472 -0
- package/package.json +54 -0
- package/test/index.test.js +393 -0
- package/test/static-testfiles/append-copy.txt +1 -0
- package/test/static-testfiles/file.txt +0 -0
- package/test/static-testfiles/test.json +3 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Test and Coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main # Adjust the branch name based on your default branch
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: npm install
|
|
19
|
+
|
|
20
|
+
- name: Run tests and collect coverage
|
|
21
|
+
run: npm run coverage
|
|
22
|
+
|
|
23
|
+
- name: Upload coverage to Codecov
|
|
24
|
+
uses: codecov/codecov-action@v2
|
|
25
|
+
with:
|
|
26
|
+
token: ${{ secrets.FS_TOKEN }}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
+
|
|
4
|
+
name: Node.js CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node-version: [16.x, 18.x]
|
|
20
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
- run: npm ci
|
|
30
|
+
- run: npm run build --if-present
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Florian Walzel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Async-file-tried
|
|
2
|
+
|
|
3
|
+
*async-file-tried* is a wrapper around node’s `fs/promises` that abstracts the try-catch block for you.
|
|
4
|
+
Write more linear, more concise code by getting a smoothed response. TypeScript supported.
|
|
5
|
+
|
|
6
|
+
## License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2023 Florian Walzel,
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install async-file-tried
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Import:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import * as fs from 'async-file-tried';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Usually we do not want to make calls against the file system without a proper error handling. But the try-catch block is somewhat unelegant because it moves code blocks in the bracket sub-space and thus disturbs the linearity of our programming. *async-file-tried* returns a tuple with either the response or the error from a fs call and simplifies error handling.
|
|
26
|
+
|
|
27
|
+
You can write now:
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
let [res, err] = await fs.readdir('.');
|
|
31
|
+
if (err) console.error(err);
|
|
32
|
+
else console.log(res);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
... instead of:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
try {
|
|
39
|
+
let res = await fs.readdir('.');
|
|
40
|
+
console.log(res);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
console.error(err);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Extra: joined paths
|
|
48
|
+
|
|
49
|
+
*async-file-tried* also has an in-built path.join() so that you can alternatively pass all path arguments as array of sub-elements.
|
|
50
|
+
|
|
51
|
+
You can write i.e.:
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
let [res, err] = await fs.appendFile(['fs.__dirname', '..' , 'myfolder', `img_${i}.txt`], 'my text');
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
... and the file string will be composed automatically.
|
|
58
|
+
|
|
59
|
+
## API
|
|
60
|
+
|
|
61
|
+
### FS Function List
|
|
62
|
+
|
|
63
|
+
- [fs.access](https://nodejs.org/api/fs.html#fspromisesaccesspath-mode)
|
|
64
|
+
+ Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
|
|
65
|
+
+ Usage example: `let [res, err] = await fs.access('file.txt', fs.constants.R_OK);`
|
|
66
|
+
|
|
67
|
+
- [fs.appendFile](https://nodejs.org/api/fs.html#fspromisesappendfilepath-data-options)
|
|
68
|
+
+ Typescript implementation: `async (path: string|Array<string>, data: any, options?: { encoding?: Encoding; mode?: number|string; flag?: Flags; })`
|
|
69
|
+
+ Usage example: `let [res, err] = await fs.appendFile('file.txt', 'foo');`
|
|
70
|
+
|
|
71
|
+
- [fs.chmod](https://nodejs.org/api/fs.html#filehandlechmodmode)
|
|
72
|
+
+ Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
|
|
73
|
+
+ Usage example: `let [res, err] = await fs.chmod('file.txt', '755');`
|
|
74
|
+
|
|
75
|
+
- [fs.chown](https://nodejs.org/api/fs.html#filehandlechownuid-gid)
|
|
76
|
+
+ Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
|
|
77
|
+
+ Usage example: `let [res, err] = await fs.chown('file.txt', 1541, 999);`
|
|
78
|
+
|
|
79
|
+
- [fs.copyFile](https://nodejs.org/api/fs.html#fspromisescopyfilesrc-dest-mode)
|
|
80
|
+
+ Typescript implementation: `async (srcPath: string|Array<string>, destPath: string|Array<string>,flags?: number)`
|
|
81
|
+
+ Usage example: `let [res, err] = await fs.copyFile('file.txt', 'file-copy.txt');`
|
|
82
|
+
|
|
83
|
+
- [fs.cp](https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options)
|
|
84
|
+
+ Typescript implementation: `async (srcPath: string|Array<string>, destPath: string|Array<string>)`
|
|
85
|
+
+ Usage example: `let [res, err] = await fs.cp('myfolder', 'myfolder-copy', {recursive: true});`
|
|
86
|
+
|
|
87
|
+
- [fs.lchmod](https://nodejs.org/api/fs.html#fspromiseslchmodpath-mode)
|
|
88
|
+
+ Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
|
|
89
|
+
+ Usage example: ``
|
|
90
|
+
|
|
91
|
+
- [fs.lchown](https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid)
|
|
92
|
+
+ Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
|
|
93
|
+
+ Usage example: `let [res, err] = await fs.lchown('./test/static-testfiles/symlinkToFile-append.txt', 1200, 1201);`
|
|
94
|
+
|
|
95
|
+
- [fs.link](https://nodejs.org/api/fs.html#fspromiseslinkexistingpath-newpath)
|
|
96
|
+
+ Typescript implementation: `async (existingPath: string|Array<string>, newPath: string|Array<string>)`
|
|
97
|
+
+ Usage example: `let [res, err] = await fs.link('file.txt', 'file-hard-link.txt');`
|
|
98
|
+
|
|
99
|
+
- [fs.lstat](https://nodejs.org/api/fs.html#fspromiseslstatpath-options)
|
|
100
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
101
|
+
+ Usage example: `let [res, err] = await fs.lstat('symlinkToFile.txt');`
|
|
102
|
+
|
|
103
|
+
- [fs.lutimes](https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime)
|
|
104
|
+
+ Typescript implementation: `async (path: string|Array<string>, atime: Date|number, mtime: Date|number)`
|
|
105
|
+
+ Usage example: `let [res, err] = await fs.lutimes('file.txt', new Date(), new Date());`
|
|
106
|
+
|
|
107
|
+
- [fs.mkdir](https://nodejs.org/api/fs.html#fspromisesmkdirpath-options)
|
|
108
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: number|string)`
|
|
109
|
+
+ Usage example: `let [res, err] = await fs.mkdir('./my-new-folder');`
|
|
110
|
+
|
|
111
|
+
- [fs.mkdtemp](https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options)
|
|
112
|
+
+ Typescript implementation: `async (prefix: string, encoding?: Encoding)`
|
|
113
|
+
+ Usage example: `let [res, err] = await fs.mkdtemp('temp-');`
|
|
114
|
+
|
|
115
|
+
- [fs.open](https://nodejs.org/api/fs.html#fspromisesopenpath-flags-mode)
|
|
116
|
+
+ Typescript implementation: `async (path: string|Array<string>, flags?: Flags, mode?: number|string)`
|
|
117
|
+
+ Usage example: `let [res, err] = await fs.open('file.txt', 'r');`
|
|
118
|
+
|
|
119
|
+
- [fs.opendir](https://nodejs.org/api/fs.html#fspromisesopendirpath-options)
|
|
120
|
+
+ Typescript implementation: `async (path: string|Array<string>, flags?: Flags, mode?: number|string)`
|
|
121
|
+
+ Usage example: `let [res, err] = await fs.opendir('./test', { encoding: "utf8", bufferSize: 64 } );`
|
|
122
|
+
|
|
123
|
+
- [fs.readFile](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
|
|
124
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: Encoding)`
|
|
125
|
+
+ Usage example: `let [res, err] = await fs.readFile('file.txt', 'utf8');`
|
|
126
|
+
|
|
127
|
+
- [fs.readdir](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
|
|
128
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
129
|
+
+ Usage example: `let [res, err] = await fs.readdir('./my-directory');`
|
|
130
|
+
|
|
131
|
+
- [fs.readlink](https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options)
|
|
132
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object|string)`
|
|
133
|
+
+ Usage example: `let [res, err] = await fs.readlink('symlinkToFile.txt');`
|
|
134
|
+
|
|
135
|
+
- [fs.realpath](https://nodejs.org/api/fs.html#fspromisesrealpathpath-options)
|
|
136
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
137
|
+
+ Usage example: `let [res, err] = await fs.realpath('./my-folder/../' );`
|
|
138
|
+
|
|
139
|
+
- [fs.rename](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
|
|
140
|
+
+ Typescript implementation: `async (oldPath: string|Array<string>, newPath: string|Array<string>)`
|
|
141
|
+
+ Usage example: `let [res, err] = await fs.rename('old.txt', 'new.txt' );`
|
|
142
|
+
|
|
143
|
+
- [fs.rm](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
|
|
144
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
145
|
+
+ Usage example: `let [res, err] = await fs.rm('file.txt' );`
|
|
146
|
+
|
|
147
|
+
- [fs.rmdir](https://nodejs.org/api/fs.html#fspromisesrmdirpath-options)
|
|
148
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
149
|
+
+ Usage example: `let [res, err] = await fs.rmdir('./my-folder');`
|
|
150
|
+
|
|
151
|
+
- [fs.stat](https://nodejs.org/api/fs.html#fspromisesstatpath-options)
|
|
152
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
153
|
+
+ Usage example: `let [res, err] = await fs.stat('file.txt');`
|
|
154
|
+
|
|
155
|
+
- [fs.symlink](https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type)
|
|
156
|
+
+ Typescript implementation: `async (target: string|Array<string>, path: string|Array<string>, type?: string)`
|
|
157
|
+
+ Usage example: `let [res, err] = await fs.symlink('file.txt', 'file-symlink.txt', 'file');`
|
|
158
|
+
|
|
159
|
+
- [fs.truncate](https://nodejs.org/api/fs.html#fspromisestruncatepath-len)
|
|
160
|
+
+ Typescript implementation: `async (path: string|Array<string>, len:number)`
|
|
161
|
+
+ Usage example: `let [res, err] = await fs.truncate('file.txt', 760);`
|
|
162
|
+
|
|
163
|
+
- [fs.unlink](https://nodejs.org/api/fs.html#fspromisesunlinkpath)
|
|
164
|
+
+ Typescript implementation: `async (path: string|Array<string>)`
|
|
165
|
+
+ Usage example: `let [res, err] = await fs.unlink('file-symlink.txt');`
|
|
166
|
+
|
|
167
|
+
- [fs.utimes](https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime)
|
|
168
|
+
+ Typescript implementation: `async (path: string|Array<string>, atime: number|string|Date, mtime: number|string|Date)`
|
|
169
|
+
+ Usage example: `let [res, err] = await fs.utimes('file.txt', new Date(), new Date());`
|
|
170
|
+
|
|
171
|
+
- [fs.watch](https://nodejs.org/api/fs.html#fspromiseswatchfilename-options)
|
|
172
|
+
+ Typescript implementation: `async (filename: string|Array<string>, options?: object|string)`
|
|
173
|
+
+ Usage example: `let [res, err] = await fs.watch('file.txt', (ev, file) => { console.log("Watcher: " + file); });`
|
|
174
|
+
|
|
175
|
+
- [fs.writeFile](https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options)
|
|
176
|
+
+ Typescript implementation: `async (path: string|Array<string>, data: any, options?: Encoding)`
|
|
177
|
+
+ Usage example: `let [res, err] = await fs.writeFile('file.txt', 'my text', 'utf8');`
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### The Constants
|
|
181
|
+
|
|
182
|
+
- [fs.constants](https://nodejs.org/api/fs.html#fspromisesconstants)
|
|
183
|
+
+ The FS [constants](https://nodejs.org/api/fs.html#fs-constants) object
|
|
184
|
+
|
|
185
|
+
- [fs.__dirname](https://nodejs.org/docs/latest/api/globals.html#__dirname)
|
|
186
|
+
+ The equivalent to node’s `__dirname` usable within ES6 Module Syntax. Returns the directory name of the current module.
|
|
187
|
+
+ Implementation: `path.dirname(fileURLToPath(import.meta.url));`
|
|
188
|
+
|
|
189
|
+
- [fs.__filename](https://nodejs.org/docs/latest/api/globals.html#__filename)
|
|
190
|
+
+ The equivalent to node’s `__filename` usable within ES6 Module Syntax. Returns the filename of the code which is executed.
|
|
191
|
+
+ Implementation: `fileURLToPath(import.meta.url);`
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### Bonus Functions
|
|
195
|
+
|
|
196
|
+
- fs.readJson
|
|
197
|
+
+ Reads a JSON file and returns it as parsed Javascript object.
|
|
198
|
+
+ Typescript implementation: `async (path: string|Array<string>, options?: Encoding)`
|
|
199
|
+
+ Usage example: `let [res, err] = await fs.readJson('my.json');`
|
|
200
|
+
|
|
201
|
+
- fs.writeJson
|
|
202
|
+
+ Expects a Javascript object and will stringify and write it out.
|
|
203
|
+
+ Typescript implementation: `async (path: string|Array<string>, data: Object, options?: Encoding)`
|
|
204
|
+
+ Usage example: `let [res, err] = await fs.writeJson('./test/static-testfiles/test.json', { key : "value" });`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as fsNormal from 'node:fs';
|
|
3
|
+
import { CopyOptions } from "node:fs";
|
|
4
|
+
/****************************************
|
|
5
|
+
* Export
|
|
6
|
+
****************************************/
|
|
7
|
+
export type Encoding = 'ascii' | 'base64' | 'binary' | 'hex' | 'ucs2' | 'utf16le' | 'utf8';
|
|
8
|
+
export type Flags = 'r' | 'r+' | 'rs' | 'rs+' | 'w' | 'wx' | 'w+' | 'wx+' | 'a' | 'ax' | 'a+' | 'ax+';
|
|
9
|
+
declare const fs: {
|
|
10
|
+
access: (path: string | Array<string>, mode?: number | string) => Promise<any[]>;
|
|
11
|
+
appendFile: (path: string | Array<string>, data: any, options?: {
|
|
12
|
+
encoding?: Encoding;
|
|
13
|
+
mode?: number | string;
|
|
14
|
+
flag?: Flags;
|
|
15
|
+
}) => Promise<any[]>;
|
|
16
|
+
chmod: (path: string | Array<string>, mode?: number | string) => Promise<any[]>;
|
|
17
|
+
chown: (path: string | Array<string>, uid: number, gid: number) => Promise<any[]>;
|
|
18
|
+
copyFile: (srcPath: string | Array<string>, destPath: string | Array<string>, flags?: number) => Promise<any[]>;
|
|
19
|
+
cp: (srcPath: string | Array<string>, destPath: string | Array<string>, options?: CopyOptions) => Promise<any[]>;
|
|
20
|
+
lchmod: (path: string | Array<string>, mode?: number | string) => Promise<any[]>;
|
|
21
|
+
lchown: (path: string | Array<string>, uid: number, gid: number) => Promise<any[]>;
|
|
22
|
+
link: (existingPath: string | Array<string>, newPath: string | Array<string>) => Promise<any[]>;
|
|
23
|
+
lstat: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
24
|
+
lutimes: (path: string | Array<string>, atime: Date | number, mtime: Date | number) => Promise<any[]>;
|
|
25
|
+
mkdir: (path: string | Array<string>, options?: number | string) => Promise<any[]>;
|
|
26
|
+
mkdtemp: (prefix: string, encoding?: Encoding) => Promise<any[]>;
|
|
27
|
+
open: (path: string | Array<string>, flags?: Flags, mode?: number | string) => Promise<any[]>;
|
|
28
|
+
opendir: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
29
|
+
readFile: (path: string | Array<string>, options?: Encoding) => Promise<any[]>;
|
|
30
|
+
readdir: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
31
|
+
readlink: (path: string | Array<string>, options?: object | string) => Promise<any[]>;
|
|
32
|
+
realpath: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
33
|
+
rename: (oldPath: string | Array<string>, newPath: string | Array<string>) => Promise<any[]>;
|
|
34
|
+
rm: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
35
|
+
rmdir: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
36
|
+
stat: (path: string | Array<string>, options?: object) => Promise<any[]>;
|
|
37
|
+
symlink: (target: string | Array<string>, path: string | Array<string>, type?: string) => Promise<any[]>;
|
|
38
|
+
truncate: (path: string | Array<string>, len: number) => Promise<any[]>;
|
|
39
|
+
unlink: (path: string | Array<string>) => Promise<any[]>;
|
|
40
|
+
utimes: (path: string | Array<string>, atime: number | string | Date, mtime: number | string | Date) => Promise<any[]>;
|
|
41
|
+
watch: (filename: string | Array<string>, options?: object | string) => Promise<any[]>;
|
|
42
|
+
writeFile: (path: string | Array<string>, data: any, options?: Encoding) => Promise<any[]>;
|
|
43
|
+
constants: typeof fsNormal.constants;
|
|
44
|
+
__dirname: string;
|
|
45
|
+
__filename: string;
|
|
46
|
+
asyncHandler: (func: Function) => Promise<any[]>;
|
|
47
|
+
readJson: (path: string | Array<string>, options?: Encoding) => Promise<any[]>;
|
|
48
|
+
writeJson: (path: string | Array<string>, data: Object, options?: Encoding) => Promise<any[]>;
|
|
49
|
+
};
|
|
50
|
+
export default fs;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAmapC;;0CAE0C;AAE1C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAC,QAAQ,GAAC,QAAQ,GAAC,KAAK,GAAC,MAAM,GAAC,SAAS,GAAC,MAAM,CAAC;AAC/E,MAAM,MAAM,KAAK,GAAG,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,CAAC;AAEhF,QAAA,MAAM,EAAE;mBAhYoB,MAAM,GAAC,MAAM,MAAM,CAAC,SAAS,MAAM,GAAC,MAAM;uBAYtC,MAAM,GAAC,MAAM,MAAM,CAAC,QAAQ,GAAG,YAAY;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAC;KAAE;kBAW5G,MAAM,GAAC,MAAM,MAAM,CAAC,SAAS,MAAM,GAAC,MAAM;kBAY1C,M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