@ohos-ports/pifs 0.0.0-stage → 2.0.0-beta.1
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/license.md +22 -0
- package/node/index.js +146 -0
- package/package.json +28 -4
- package/readme.md +28 -0
- package/types/index.d.ts +93 -0
- package/README.md +0 -3
package/license.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
* Copyright (c) 2019–2020 Bubble Dev
|
|
4
|
+
* Copyright (c) 2020–present NexTools
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
package/node/index.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WriteStream = exports.ReadStream = exports.Stats = exports.Dirent = exports.writeFile = exports.write = exports.watchFile = exports.watch = exports.utimes = exports.unwatchFile = exports.unlink = exports.truncate = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.realpath = exports.readlink = exports.readFile = exports.readdir = exports.read = exports.open = exports.mkdtemp = exports.mkdir = exports.lstat = exports.link = exports.lchown = exports.lchmod = exports.futimes = exports.ftruncate = exports.fsync = exports.fstat = exports.fdatasync = exports.fchown = exports.fchmod = exports.createWriteStream = exports.createReadStream = exports.copyFile = exports.constants = exports.close = exports.chown = exports.chmod = exports.appendFile = exports.access = void 0;
|
|
7
|
+
|
|
8
|
+
var _util = require("util");
|
|
9
|
+
|
|
10
|
+
var _gracefulFs = _interopRequireDefault(require("graceful-fs"));
|
|
11
|
+
|
|
12
|
+
const access = (0, _util.promisify)(_gracefulFs.default.access);
|
|
13
|
+
exports.access = access;
|
|
14
|
+
const appendFile = (0, _util.promisify)(_gracefulFs.default.appendFile);
|
|
15
|
+
exports.appendFile = appendFile;
|
|
16
|
+
const chmod = (0, _util.promisify)(_gracefulFs.default.chmod);
|
|
17
|
+
exports.chmod = chmod;
|
|
18
|
+
const chown = (0, _util.promisify)(_gracefulFs.default.chown);
|
|
19
|
+
exports.chown = chown;
|
|
20
|
+
const close = (0, _util.promisify)(_gracefulFs.default.close);
|
|
21
|
+
exports.close = close;
|
|
22
|
+
const constants = _gracefulFs.default.constants;
|
|
23
|
+
exports.constants = constants;
|
|
24
|
+
const copyFile = (0, _util.promisify)(_gracefulFs.default.copyFile);
|
|
25
|
+
exports.copyFile = copyFile;
|
|
26
|
+
const createReadStream = _gracefulFs.default.createReadStream;
|
|
27
|
+
exports.createReadStream = createReadStream;
|
|
28
|
+
const createWriteStream = _gracefulFs.default.createWriteStream;
|
|
29
|
+
exports.createWriteStream = createWriteStream;
|
|
30
|
+
const fchmod = (0, _util.promisify)(_gracefulFs.default.fchmod);
|
|
31
|
+
exports.fchmod = fchmod;
|
|
32
|
+
const fchown = (0, _util.promisify)(_gracefulFs.default.fchown);
|
|
33
|
+
exports.fchown = fchown;
|
|
34
|
+
const fdatasync = (0, _util.promisify)(_gracefulFs.default.fdatasync);
|
|
35
|
+
exports.fdatasync = fdatasync;
|
|
36
|
+
const fstat = (0, _util.promisify)(_gracefulFs.default.fstat);
|
|
37
|
+
exports.fstat = fstat;
|
|
38
|
+
const fsync = (0, _util.promisify)(_gracefulFs.default.fsync);
|
|
39
|
+
exports.fsync = fsync;
|
|
40
|
+
const ftruncate = (0, _util.promisify)(_gracefulFs.default.ftruncate);
|
|
41
|
+
exports.ftruncate = ftruncate;
|
|
42
|
+
const futimes = (0, _util.promisify)(_gracefulFs.default.futimes);
|
|
43
|
+
exports.futimes = futimes;
|
|
44
|
+
const lchmod = (0, _util.promisify)(_gracefulFs.default.lchmod);
|
|
45
|
+
exports.lchmod = lchmod;
|
|
46
|
+
const lchown = (0, _util.promisify)(_gracefulFs.default.lchown);
|
|
47
|
+
exports.lchown = lchown;
|
|
48
|
+
const link = (0, _util.promisify)(_gracefulFs.default.link);
|
|
49
|
+
exports.link = link;
|
|
50
|
+
const lstat = (0, _util.promisify)(_gracefulFs.default.lstat);
|
|
51
|
+
exports.lstat = lstat;
|
|
52
|
+
const mkdir = (0, _util.promisify)(_gracefulFs.default.mkdir);
|
|
53
|
+
exports.mkdir = mkdir;
|
|
54
|
+
const mkdtemp = (0, _util.promisify)(_gracefulFs.default.mkdtemp);
|
|
55
|
+
exports.mkdtemp = mkdtemp;
|
|
56
|
+
const open = (0, _util.promisify)(_gracefulFs.default.open);
|
|
57
|
+
exports.open = open;
|
|
58
|
+
const read = (0, _util.promisify)(_gracefulFs.default.read);
|
|
59
|
+
exports.read = read;
|
|
60
|
+
const readdir = (0, _util.promisify)(_gracefulFs.default.readdir);
|
|
61
|
+
exports.readdir = readdir;
|
|
62
|
+
const readFile = (0, _util.promisify)(_gracefulFs.default.readFile);
|
|
63
|
+
exports.readFile = readFile;
|
|
64
|
+
const readlink = (0, _util.promisify)(_gracefulFs.default.readlink);
|
|
65
|
+
exports.readlink = readlink;
|
|
66
|
+
const realpath = (0, _util.promisify)(_gracefulFs.default.realpath);
|
|
67
|
+
exports.realpath = realpath;
|
|
68
|
+
const rename = (0, _util.promisify)(_gracefulFs.default.rename);
|
|
69
|
+
exports.rename = rename;
|
|
70
|
+
const rmdir = (0, _util.promisify)(_gracefulFs.default.rmdir);
|
|
71
|
+
exports.rmdir = rmdir;
|
|
72
|
+
const stat = (0, _util.promisify)(_gracefulFs.default.stat);
|
|
73
|
+
exports.stat = stat;
|
|
74
|
+
const symlink = (0, _util.promisify)(_gracefulFs.default.symlink);
|
|
75
|
+
exports.symlink = symlink;
|
|
76
|
+
const truncate = (0, _util.promisify)(_gracefulFs.default.truncate);
|
|
77
|
+
exports.truncate = truncate;
|
|
78
|
+
const unlink = (0, _util.promisify)(_gracefulFs.default.unlink);
|
|
79
|
+
exports.unlink = unlink;
|
|
80
|
+
const unwatchFile = _gracefulFs.default.unwatchFile;
|
|
81
|
+
exports.unwatchFile = unwatchFile;
|
|
82
|
+
const utimes = (0, _util.promisify)(_gracefulFs.default.utimes);
|
|
83
|
+
exports.utimes = utimes;
|
|
84
|
+
const watch = _gracefulFs.default.watch;
|
|
85
|
+
exports.watch = watch;
|
|
86
|
+
const watchFile = _gracefulFs.default.watchFile;
|
|
87
|
+
exports.watchFile = watchFile;
|
|
88
|
+
const write = (0, _util.promisify)(_gracefulFs.default.write);
|
|
89
|
+
exports.write = write;
|
|
90
|
+
const writeFile = (0, _util.promisify)(_gracefulFs.default.writeFile);
|
|
91
|
+
exports.writeFile = writeFile;
|
|
92
|
+
const Dirent = _gracefulFs.default.Dirent;
|
|
93
|
+
exports.Dirent = Dirent;
|
|
94
|
+
const Stats = _gracefulFs.default.Stats;
|
|
95
|
+
exports.Stats = Stats;
|
|
96
|
+
const ReadStream = _gracefulFs.default.ReadStream;
|
|
97
|
+
exports.ReadStream = ReadStream;
|
|
98
|
+
const WriteStream = _gracefulFs.default.WriteStream;
|
|
99
|
+
exports.WriteStream = WriteStream;
|
|
100
|
+
var _default = {
|
|
101
|
+
access,
|
|
102
|
+
appendFile,
|
|
103
|
+
chmod,
|
|
104
|
+
chown,
|
|
105
|
+
close,
|
|
106
|
+
constants,
|
|
107
|
+
copyFile,
|
|
108
|
+
createReadStream,
|
|
109
|
+
createWriteStream,
|
|
110
|
+
fchmod,
|
|
111
|
+
fchown,
|
|
112
|
+
fdatasync,
|
|
113
|
+
fstat,
|
|
114
|
+
fsync,
|
|
115
|
+
ftruncate,
|
|
116
|
+
futimes,
|
|
117
|
+
lchmod,
|
|
118
|
+
lchown,
|
|
119
|
+
link,
|
|
120
|
+
lstat,
|
|
121
|
+
mkdir,
|
|
122
|
+
mkdtemp,
|
|
123
|
+
open,
|
|
124
|
+
read,
|
|
125
|
+
readdir,
|
|
126
|
+
readFile,
|
|
127
|
+
readlink,
|
|
128
|
+
realpath,
|
|
129
|
+
rename,
|
|
130
|
+
rmdir,
|
|
131
|
+
stat,
|
|
132
|
+
symlink,
|
|
133
|
+
truncate,
|
|
134
|
+
unlink,
|
|
135
|
+
unwatchFile,
|
|
136
|
+
utimes,
|
|
137
|
+
watch,
|
|
138
|
+
watchFile,
|
|
139
|
+
write,
|
|
140
|
+
writeFile,
|
|
141
|
+
Dirent,
|
|
142
|
+
Stats,
|
|
143
|
+
ReadStream,
|
|
144
|
+
WriteStream
|
|
145
|
+
};
|
|
146
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/pifs",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Promisified graceful-fs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fs",
|
|
7
|
+
"graceful-fs",
|
|
8
|
+
"promise",
|
|
9
|
+
"promisify"
|
|
10
|
+
],
|
|
11
|
+
"types": "types/index.d.ts",
|
|
12
|
+
"main": "node/index.js",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
16
|
+
"directory": "ports/pifs/2.0.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=12.13.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@babel/runtime": "^7.0.0",
|
|
24
|
+
"@types/graceful-fs": "^4.1.3",
|
|
25
|
+
"graceful-fs": "^4.2.0"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/ohos-ports/ohos-ports/issues"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# pifs 
|
|
2
|
+
|
|
3
|
+
Promisified [graceful-fs](https://github.com/isaacs/node-graceful-fs).
|
|
4
|
+
|
|
5
|
+
* aligned with Node.js v10
|
|
6
|
+
* native `util.promisify()`
|
|
7
|
+
* no sync methods
|
|
8
|
+
* no deprecated methods like `exists`
|
|
9
|
+
* no undocumented exports like `FileReadStream` or `F_OK`
|
|
10
|
+
* no `promises` :)
|
|
11
|
+
* non-callback methods like `createReadStream` or `watch` are re-exported as is
|
|
12
|
+
* `constants` is re-exported as is
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
$ yarn add pifs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { readFile } from 'pifs'
|
|
24
|
+
|
|
25
|
+
readFile('/file/path', 'utf8')
|
|
26
|
+
.then(console.log)
|
|
27
|
+
.catch(console.error)
|
|
28
|
+
```
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import fs from 'graceful-fs';
|
|
3
|
+
export declare const access: typeof fs.access.__promisify__;
|
|
4
|
+
export declare const appendFile: typeof fs.appendFile.__promisify__;
|
|
5
|
+
export declare const chmod: typeof fs.chmod.__promisify__;
|
|
6
|
+
export declare const chown: typeof fs.chown.__promisify__;
|
|
7
|
+
export declare const close: typeof fs.close.__promisify__;
|
|
8
|
+
export declare const constants: typeof fs.constants;
|
|
9
|
+
export declare const copyFile: typeof fs.copyFile.__promisify__;
|
|
10
|
+
export declare const createReadStream: typeof fs.createReadStream;
|
|
11
|
+
export declare const createWriteStream: typeof fs.createWriteStream;
|
|
12
|
+
export declare const fchmod: typeof fs.fchmod.__promisify__;
|
|
13
|
+
export declare const fchown: typeof fs.fchown.__promisify__;
|
|
14
|
+
export declare const fdatasync: typeof fs.fdatasync.__promisify__;
|
|
15
|
+
export declare const fstat: typeof fs.fstat.__promisify__;
|
|
16
|
+
export declare const fsync: typeof fs.fsync.__promisify__;
|
|
17
|
+
export declare const ftruncate: typeof fs.ftruncate.__promisify__;
|
|
18
|
+
export declare const futimes: typeof fs.futimes.__promisify__;
|
|
19
|
+
export declare const lchmod: typeof fs.lchmod.__promisify__;
|
|
20
|
+
export declare const lchown: typeof fs.lchown.__promisify__;
|
|
21
|
+
export declare const link: typeof fs.link.__promisify__;
|
|
22
|
+
export declare const lstat: typeof fs.lstat.__promisify__;
|
|
23
|
+
export declare const mkdir: typeof fs.mkdir.__promisify__;
|
|
24
|
+
export declare const mkdtemp: typeof fs.mkdtemp.__promisify__;
|
|
25
|
+
export declare const open: typeof fs.open.__promisify__;
|
|
26
|
+
export declare const read: typeof fs.read.__promisify__;
|
|
27
|
+
export declare const readdir: typeof fs.readdir.__promisify__;
|
|
28
|
+
export declare const readFile: typeof fs.readFile.__promisify__;
|
|
29
|
+
export declare const readlink: typeof fs.readlink.__promisify__;
|
|
30
|
+
export declare const realpath: typeof fs.realpath.__promisify__;
|
|
31
|
+
export declare const rename: typeof fs.rename.__promisify__;
|
|
32
|
+
export declare const rmdir: typeof fs.rmdir.__promisify__;
|
|
33
|
+
export declare const stat: typeof fs.stat.__promisify__;
|
|
34
|
+
export declare const symlink: typeof fs.symlink.__promisify__;
|
|
35
|
+
export declare const truncate: typeof fs.truncate.__promisify__;
|
|
36
|
+
export declare const unlink: typeof fs.unlink.__promisify__;
|
|
37
|
+
export declare const unwatchFile: typeof fs.unwatchFile;
|
|
38
|
+
export declare const utimes: typeof fs.utimes.__promisify__;
|
|
39
|
+
export declare const watch: typeof fs.watch;
|
|
40
|
+
export declare const watchFile: typeof fs.watchFile;
|
|
41
|
+
export declare const write: typeof fs.write.__promisify__;
|
|
42
|
+
export declare const writeFile: typeof fs.writeFile.__promisify__;
|
|
43
|
+
export declare const Dirent: typeof fs.Dirent;
|
|
44
|
+
export declare const Stats: typeof fs.Stats;
|
|
45
|
+
export declare const ReadStream: typeof fs.ReadStream;
|
|
46
|
+
export declare const WriteStream: typeof fs.WriteStream;
|
|
47
|
+
declare const _default: {
|
|
48
|
+
access: typeof fs.access.__promisify__;
|
|
49
|
+
appendFile: typeof fs.appendFile.__promisify__;
|
|
50
|
+
chmod: typeof fs.chmod.__promisify__;
|
|
51
|
+
chown: typeof fs.chown.__promisify__;
|
|
52
|
+
close: typeof fs.close.__promisify__;
|
|
53
|
+
constants: typeof fs.constants;
|
|
54
|
+
copyFile: typeof fs.copyFile.__promisify__;
|
|
55
|
+
createReadStream: typeof fs.createReadStream;
|
|
56
|
+
createWriteStream: typeof fs.createWriteStream;
|
|
57
|
+
fchmod: typeof fs.fchmod.__promisify__;
|
|
58
|
+
fchown: typeof fs.fchown.__promisify__;
|
|
59
|
+
fdatasync: typeof fs.fdatasync.__promisify__;
|
|
60
|
+
fstat: typeof fs.fstat.__promisify__;
|
|
61
|
+
fsync: typeof fs.fsync.__promisify__;
|
|
62
|
+
ftruncate: typeof fs.ftruncate.__promisify__;
|
|
63
|
+
futimes: typeof fs.futimes.__promisify__;
|
|
64
|
+
lchmod: typeof fs.lchmod.__promisify__;
|
|
65
|
+
lchown: typeof fs.lchown.__promisify__;
|
|
66
|
+
link: typeof fs.link.__promisify__;
|
|
67
|
+
lstat: typeof fs.lstat.__promisify__;
|
|
68
|
+
mkdir: typeof fs.mkdir.__promisify__;
|
|
69
|
+
mkdtemp: typeof fs.mkdtemp.__promisify__;
|
|
70
|
+
open: typeof fs.open.__promisify__;
|
|
71
|
+
read: typeof fs.read.__promisify__;
|
|
72
|
+
readdir: typeof fs.readdir.__promisify__;
|
|
73
|
+
readFile: typeof fs.readFile.__promisify__;
|
|
74
|
+
readlink: typeof fs.readlink.__promisify__;
|
|
75
|
+
realpath: typeof fs.realpath.__promisify__;
|
|
76
|
+
rename: typeof fs.rename.__promisify__;
|
|
77
|
+
rmdir: typeof fs.rmdir.__promisify__;
|
|
78
|
+
stat: typeof fs.stat.__promisify__;
|
|
79
|
+
symlink: typeof fs.symlink.__promisify__;
|
|
80
|
+
truncate: typeof fs.truncate.__promisify__;
|
|
81
|
+
unlink: typeof fs.unlink.__promisify__;
|
|
82
|
+
unwatchFile: typeof fs.unwatchFile;
|
|
83
|
+
utimes: typeof fs.utimes.__promisify__;
|
|
84
|
+
watch: typeof fs.watch;
|
|
85
|
+
watchFile: typeof fs.watchFile;
|
|
86
|
+
write: typeof fs.write.__promisify__;
|
|
87
|
+
writeFile: typeof fs.writeFile.__promisify__;
|
|
88
|
+
Dirent: typeof fs.Dirent;
|
|
89
|
+
Stats: typeof fs.Stats;
|
|
90
|
+
ReadStream: typeof fs.ReadStream;
|
|
91
|
+
WriteStream: typeof fs.WriteStream;
|
|
92
|
+
};
|
|
93
|
+
export default _default;
|
package/README.md
DELETED