extra-filesystem 0.4.6 → 0.4.8
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/README.md +27 -5
- package/lib/es2015/find-all-dirnames.d.ts +1 -1
- package/lib/es2015/find-all-filenames.d.ts +1 -1
- package/lib/es2015/index.d.ts +2 -0
- package/lib/es2015/index.js +2 -0
- package/lib/es2015/index.js.map +1 -1
- package/lib/es2015/read-file-line-by-line-sync.d.ts +1 -1
- package/lib/es2015/read-json-file-sync.d.ts +2 -1
- package/lib/es2015/read-json-file-sync.js +2 -2
- package/lib/es2015/read-json-file-sync.js.map +1 -1
- package/lib/es2015/read-json-file.d.ts +2 -1
- package/lib/es2015/read-json-file.js +2 -2
- package/lib/es2015/read-json-file.js.map +1 -1
- package/lib/es2015/read-ndjson-file-sync.d.ts +2 -0
- package/lib/es2015/read-ndjson-file-sync.js +11 -0
- package/lib/es2015/read-ndjson-file-sync.js.map +1 -0
- package/lib/es2015/read-ndjson-file.d.ts +2 -0
- package/lib/es2015/read-ndjson-file.js +11 -0
- package/lib/es2015/read-ndjson-file.js.map +1 -0
- package/lib/es2018/find-all-dirnames.d.ts +1 -1
- package/lib/es2018/find-all-filenames.d.ts +1 -1
- package/lib/es2018/index.d.ts +2 -0
- package/lib/es2018/index.js +2 -0
- package/lib/es2018/index.js.map +1 -1
- package/lib/es2018/read-file-line-by-line-sync.d.ts +1 -1
- package/lib/es2018/read-json-file-sync.d.ts +2 -1
- package/lib/es2018/read-json-file-sync.js +2 -2
- package/lib/es2018/read-json-file-sync.js.map +1 -1
- package/lib/es2018/read-json-file.d.ts +2 -1
- package/lib/es2018/read-json-file.js +2 -2
- package/lib/es2018/read-json-file.js.map +1 -1
- package/lib/es2018/read-ndjson-file-sync.d.ts +2 -0
- package/lib/es2018/read-ndjson-file-sync.js +11 -0
- package/lib/es2018/read-ndjson-file-sync.js.map +1 -0
- package/lib/es2018/read-ndjson-file.d.ts +2 -0
- package/lib/es2018/read-ndjson-file.js +11 -0
- package/lib/es2018/read-ndjson-file.js.map +1 -0
- package/package.json +15 -14
package/README.md
CHANGED
|
@@ -77,14 +77,36 @@ function pathExists(path: string): Promise<boolean>
|
|
|
77
77
|
function pathExistsSync(path: string): boolean
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
### readNDJSONFile
|
|
81
|
+
```ts
|
|
82
|
+
function readNDJSONFile<T>(
|
|
83
|
+
filename: string
|
|
84
|
+
, encoding: BufferEncoding = 'utf-8'
|
|
85
|
+
): AsyncIterableIterator<T>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### readNDJSONFileSync
|
|
89
|
+
```ts
|
|
90
|
+
function readNDJSONFileSync<T>(
|
|
91
|
+
filename: string
|
|
92
|
+
, encoding: BufferEncoding = 'utf-8'
|
|
93
|
+
): IterableIterator<T>
|
|
94
|
+
```
|
|
95
|
+
|
|
80
96
|
### readJSONFile
|
|
81
97
|
```ts
|
|
82
|
-
function readJSONFile<T>(
|
|
98
|
+
function readJSONFile<T>(
|
|
99
|
+
filename: string
|
|
100
|
+
, encoding: BufferEncoding = 'utf-8'
|
|
101
|
+
): Promise<T>
|
|
83
102
|
```
|
|
84
103
|
|
|
85
104
|
### readJSONFileSync
|
|
86
105
|
```ts
|
|
87
|
-
function readJSONFileSync<T>(
|
|
106
|
+
function readJSONFileSync<T>(
|
|
107
|
+
filename: string
|
|
108
|
+
, encoding: BufferEncoding = 'utf-8'
|
|
109
|
+
): T
|
|
88
110
|
```
|
|
89
111
|
|
|
90
112
|
### writeJSONFile
|
|
@@ -160,7 +182,7 @@ function isReadable(path: string): Promise<boolean>
|
|
|
160
182
|
function findAllFilenames(
|
|
161
183
|
dirname: string
|
|
162
184
|
, predicate: (dirname: string) => boolean = _ => true
|
|
163
|
-
):
|
|
185
|
+
): AsyncIterableIterator<string>
|
|
164
186
|
```
|
|
165
187
|
|
|
166
188
|
### findAllDirnames
|
|
@@ -168,7 +190,7 @@ function findAllFilenames(
|
|
|
168
190
|
function findAllDirnames(
|
|
169
191
|
dirname: string
|
|
170
192
|
, predicate: (dirname: string) => boolean = _ => true
|
|
171
|
-
):
|
|
193
|
+
): AsyncIterableIterator<string>
|
|
172
194
|
```
|
|
173
195
|
|
|
174
196
|
### getLongExtension
|
|
@@ -206,7 +228,7 @@ function readFileLineByLine(
|
|
|
206
228
|
function* readFileLineByLineSync(
|
|
207
229
|
filename: string
|
|
208
230
|
, encoding: BufferEncoding = 'utf-8'
|
|
209
|
-
):
|
|
231
|
+
): IterableIterator<string>
|
|
210
232
|
```
|
|
211
233
|
|
|
212
234
|
### writeIterableToFile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function findAllDirnames(dirname: string, predicate?: (dirname: string) => boolean):
|
|
1
|
+
export declare function findAllDirnames(dirname: string, predicate?: (dirname: string) => boolean): AsyncIterableIterator<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function findAllFilenames(dirname: string, predicate?: (dirname: string) => boolean):
|
|
1
|
+
export declare function findAllFilenames(dirname: string, predicate?: (dirname: string) => boolean): AsyncIterableIterator<string>;
|
package/lib/es2015/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from './ensure-file';
|
|
|
12
12
|
export * from './ensure-file-sync';
|
|
13
13
|
export * from './path-exists';
|
|
14
14
|
export * from './path-exists-sync';
|
|
15
|
+
export * from './read-ndjson-file';
|
|
16
|
+
export * from './read-ndjson-file-sync';
|
|
15
17
|
export * from './read-json-file';
|
|
16
18
|
export * from './read-json-file-sync';
|
|
17
19
|
export * from './write-json-file';
|
package/lib/es2015/index.js
CHANGED
|
@@ -28,6 +28,8 @@ __exportStar(require("./ensure-file"), exports);
|
|
|
28
28
|
__exportStar(require("./ensure-file-sync"), exports);
|
|
29
29
|
__exportStar(require("./path-exists"), exports);
|
|
30
30
|
__exportStar(require("./path-exists-sync"), exports);
|
|
31
|
+
__exportStar(require("./read-ndjson-file"), exports);
|
|
32
|
+
__exportStar(require("./read-ndjson-file-sync"), exports);
|
|
31
33
|
__exportStar(require("./read-json-file"), exports);
|
|
32
34
|
__exportStar(require("./read-json-file-sync"), exports);
|
|
33
35
|
__exportStar(require("./write-json-file"), exports);
|
package/lib/es2015/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,yDAAsC;AACtC,qDAAkC;AAClC,0DAAuC;AACvC,qDAAkC;AAClC,0DAAuC;AACvC,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAC5B,oDAAiC;AACjC,gDAA6B;AAC7B,qDAAkC;AAClC,gDAA6B;AAC7B,qDAAkC;AAClC,mDAAgC;AAChC,wDAAqC;AACrC,oDAAiC;AACjC,yDAAsC;AACtC,2DAAwC;AACxC,2DAAwC;AACxC,gEAA6C;AAC7C,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,uDAAoC;AACpC,sDAAmC;AACnC,uDAAoC;AACpC,uDAAoC;AACpC,iDAA8B;AAC9B,sDAAmC;AACnC,4CAAyB;AACzB,iDAA8B;AAC9B,gDAA6B;AAC7B,gDAA6B;AAC7B,mDAAgC;AAChC,kDAA+B;AAC/B,6DAA0C;AAC1C,kEAA+C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,yDAAsC;AACtC,qDAAkC;AAClC,0DAAuC;AACvC,qDAAkC;AAClC,0DAAuC;AACvC,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAC5B,oDAAiC;AACjC,gDAA6B;AAC7B,qDAAkC;AAClC,gDAA6B;AAC7B,qDAAkC;AAClC,qDAAkC;AAClC,0DAAuC;AACvC,mDAAgC;AAChC,wDAAqC;AACrC,oDAAiC;AACjC,yDAAsC;AACtC,2DAAwC;AACxC,2DAAwC;AACxC,gEAA6C;AAC7C,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,uDAAoC;AACpC,sDAAmC;AACnC,uDAAoC;AACpC,uDAAoC;AACpC,iDAA8B;AAC9B,sDAAmC;AACnC,4CAAyB;AACzB,iDAA8B;AAC9B,gDAA6B;AAC7B,gDAA6B;AAC7B,mDAAgC;AAChC,kDAA+B;AAC/B,6DAA0C;AAC1C,kEAA+C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare function readFileLineByLineSync(filename: string, encoding?: BufferEncoding):
|
|
2
|
+
export declare function readFileLineByLineSync(filename: string, encoding?: BufferEncoding): IterableIterator<string>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function readJSONFileSync<T>(filename: string, encoding?: BufferEncoding): T;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readJSONFileSync = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
|
-
function readJSONFileSync(filename) {
|
|
6
|
-
const text = fs.readFileSync(filename,
|
|
5
|
+
function readJSONFileSync(filename, encoding = 'utf-8') {
|
|
6
|
+
const text = fs.readFileSync(filename, encoding);
|
|
7
7
|
return JSON.parse(text);
|
|
8
8
|
}
|
|
9
9
|
exports.readJSONFileSync = readJSONFileSync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-json-file-sync.js","sourceRoot":"","sources":["../../src/read-json-file-sync.ts"],"names":[],"mappings":";;;AAAA,yBAAwB;AAExB,SAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"read-json-file-sync.js","sourceRoot":"","sources":["../../src/read-json-file-sync.ts"],"names":[],"mappings":";;;AAAA,yBAAwB;AAExB,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,WAA2B,OAAO;IAElC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAND,4CAMC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function readJSONFile<T>(filename: string, encoding?: BufferEncoding): Promise<T>;
|
|
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.readJSONFile = void 0;
|
|
13
13
|
const fs = require("fs/promises");
|
|
14
|
-
function readJSONFile(filename) {
|
|
14
|
+
function readJSONFile(filename, encoding = 'utf-8') {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const text = yield fs.readFile(filename,
|
|
16
|
+
const text = yield fs.readFile(filename, encoding);
|
|
17
17
|
return JSON.parse(text);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-json-file.js","sourceRoot":"","sources":["../../src/read-json-file.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kCAAiC;AAEjC,SAAsB,YAAY,
|
|
1
|
+
{"version":3,"file":"read-json-file.js","sourceRoot":"","sources":["../../src/read-json-file.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kCAAiC;AAEjC,SAAsB,YAAY,CAChC,QAAgB,EAChB,WAA2B,OAAO;;QAElC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;CAAA;AAND,oCAMC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readNDJSONFileSync = void 0;
|
|
4
|
+
const iterable_operator_1 = require("iterable-operator");
|
|
5
|
+
const read_file_line_by_line_sync_1 = require("./read-file-line-by-line-sync");
|
|
6
|
+
const extra_utils_1 = require("extra-utils");
|
|
7
|
+
function readNDJSONFileSync(filename, encoding = 'utf-8') {
|
|
8
|
+
return (0, extra_utils_1.pipe)((0, read_file_line_by_line_sync_1.readFileLineByLineSync)(filename, encoding), iter => (0, iterable_operator_1.filter)(iter, line => line.trim() !== ''), iter => (0, iterable_operator_1.map)(iter, line => JSON.parse(line)));
|
|
9
|
+
}
|
|
10
|
+
exports.readNDJSONFileSync = readNDJSONFileSync;
|
|
11
|
+
//# sourceMappingURL=read-ndjson-file-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-ndjson-file-sync.js","sourceRoot":"","sources":["../../src/read-ndjson-file-sync.ts"],"names":[],"mappings":";;;AAAA,yDAA+C;AAC/C,+EAAsE;AACtE,6CAAkC;AAElC,SAAgB,kBAAkB,CAChC,QAAgB,EAChB,WAA2B,OAAO;IAElC,OAAO,IAAA,kBAAI,EACT,IAAA,oDAAsB,EAAC,QAAQ,EAAE,QAAQ,CAAC,EAC1C,IAAI,CAAC,EAAE,CAAC,IAAA,0BAAM,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAChD,IAAI,CAAC,EAAE,CAAC,IAAA,uBAAG,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAC5C,CAAA;AACH,CAAC;AATD,gDASC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readNDJSONFile = void 0;
|
|
4
|
+
const iterable_operator_1 = require("iterable-operator");
|
|
5
|
+
const read_file_line_by_line_1 = require("./read-file-line-by-line");
|
|
6
|
+
const extra_utils_1 = require("extra-utils");
|
|
7
|
+
function readNDJSONFile(filename, encoding = 'utf-8') {
|
|
8
|
+
return (0, extra_utils_1.pipe)((0, read_file_line_by_line_1.readFileLineByLine)(filename, encoding), iter => (0, iterable_operator_1.filterAsync)(iter, line => line.trim() !== ''), iter => (0, iterable_operator_1.mapAsync)(iter, line => JSON.parse(line)));
|
|
9
|
+
}
|
|
10
|
+
exports.readNDJSONFile = readNDJSONFile;
|
|
11
|
+
//# sourceMappingURL=read-ndjson-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-ndjson-file.js","sourceRoot":"","sources":["../../src/read-ndjson-file.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,qEAA6D;AAC7D,6CAAkC;AAElC,SAAgB,cAAc,CAC5B,QAAgB,EAChB,WAA2B,OAAO;IAElC,OAAO,IAAA,kBAAI,EACT,IAAA,2CAAkB,EAAC,QAAQ,EAAE,QAAQ,CAAC,EACtC,IAAI,CAAC,EAAE,CAAC,IAAA,+BAAW,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EACrD,IAAI,CAAC,EAAE,CAAC,IAAA,4BAAQ,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CACjD,CAAA;AACH,CAAC;AATD,wCASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function findAllDirnames(dirname: string, predicate?: (dirname: string) => boolean):
|
|
1
|
+
export declare function findAllDirnames(dirname: string, predicate?: (dirname: string) => boolean): AsyncIterableIterator<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function findAllFilenames(dirname: string, predicate?: (dirname: string) => boolean):
|
|
1
|
+
export declare function findAllFilenames(dirname: string, predicate?: (dirname: string) => boolean): AsyncIterableIterator<string>;
|
package/lib/es2018/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from './ensure-file';
|
|
|
12
12
|
export * from './ensure-file-sync';
|
|
13
13
|
export * from './path-exists';
|
|
14
14
|
export * from './path-exists-sync';
|
|
15
|
+
export * from './read-ndjson-file';
|
|
16
|
+
export * from './read-ndjson-file-sync';
|
|
15
17
|
export * from './read-json-file';
|
|
16
18
|
export * from './read-json-file-sync';
|
|
17
19
|
export * from './write-json-file';
|
package/lib/es2018/index.js
CHANGED
|
@@ -28,6 +28,8 @@ __exportStar(require("./ensure-file"), exports);
|
|
|
28
28
|
__exportStar(require("./ensure-file-sync"), exports);
|
|
29
29
|
__exportStar(require("./path-exists"), exports);
|
|
30
30
|
__exportStar(require("./path-exists-sync"), exports);
|
|
31
|
+
__exportStar(require("./read-ndjson-file"), exports);
|
|
32
|
+
__exportStar(require("./read-ndjson-file-sync"), exports);
|
|
31
33
|
__exportStar(require("./read-json-file"), exports);
|
|
32
34
|
__exportStar(require("./read-json-file-sync"), exports);
|
|
33
35
|
__exportStar(require("./write-json-file"), exports);
|
package/lib/es2018/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,yDAAsC;AACtC,qDAAkC;AAClC,0DAAuC;AACvC,qDAAkC;AAClC,0DAAuC;AACvC,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAC5B,oDAAiC;AACjC,gDAA6B;AAC7B,qDAAkC;AAClC,gDAA6B;AAC7B,qDAAkC;AAClC,mDAAgC;AAChC,wDAAqC;AACrC,oDAAiC;AACjC,yDAAsC;AACtC,2DAAwC;AACxC,2DAAwC;AACxC,gEAA6C;AAC7C,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,uDAAoC;AACpC,sDAAmC;AACnC,uDAAoC;AACpC,uDAAoC;AACpC,iDAA8B;AAC9B,sDAAmC;AACnC,4CAAyB;AACzB,iDAA8B;AAC9B,gDAA6B;AAC7B,gDAA6B;AAC7B,mDAAgC;AAChC,kDAA+B;AAC/B,6DAA0C;AAC1C,kEAA+C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,yDAAsC;AACtC,qDAAkC;AAClC,0DAAuC;AACvC,qDAAkC;AAClC,0DAAuC;AACvC,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAC5B,oDAAiC;AACjC,gDAA6B;AAC7B,qDAAkC;AAClC,gDAA6B;AAC7B,qDAAkC;AAClC,qDAAkC;AAClC,0DAAuC;AACvC,mDAAgC;AAChC,wDAAqC;AACrC,oDAAiC;AACjC,yDAAsC;AACtC,2DAAwC;AACxC,2DAAwC;AACxC,gEAA6C;AAC7C,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,uDAAoC;AACpC,sDAAmC;AACnC,uDAAoC;AACpC,uDAAoC;AACpC,iDAA8B;AAC9B,sDAAmC;AACnC,4CAAyB;AACzB,iDAA8B;AAC9B,gDAA6B;AAC7B,gDAA6B;AAC7B,mDAAgC;AAChC,kDAA+B;AAC/B,6DAA0C;AAC1C,kEAA+C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare function readFileLineByLineSync(filename: string, encoding?: BufferEncoding):
|
|
2
|
+
export declare function readFileLineByLineSync(filename: string, encoding?: BufferEncoding): IterableIterator<string>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function readJSONFileSync<T>(filename: string, encoding?: BufferEncoding): T;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readJSONFileSync = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
|
-
function readJSONFileSync(filename) {
|
|
6
|
-
const text = fs.readFileSync(filename,
|
|
5
|
+
function readJSONFileSync(filename, encoding = 'utf-8') {
|
|
6
|
+
const text = fs.readFileSync(filename, encoding);
|
|
7
7
|
return JSON.parse(text);
|
|
8
8
|
}
|
|
9
9
|
exports.readJSONFileSync = readJSONFileSync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-json-file-sync.js","sourceRoot":"","sources":["../../src/read-json-file-sync.ts"],"names":[],"mappings":";;;AAAA,yBAAwB;AAExB,SAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"read-json-file-sync.js","sourceRoot":"","sources":["../../src/read-json-file-sync.ts"],"names":[],"mappings":";;;AAAA,yBAAwB;AAExB,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,WAA2B,OAAO;IAElC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAND,4CAMC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function readJSONFile<T>(filename: string, encoding?: BufferEncoding): Promise<T>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readJSONFile = void 0;
|
|
4
4
|
const fs = require("fs/promises");
|
|
5
|
-
async function readJSONFile(filename) {
|
|
6
|
-
const text = await fs.readFile(filename,
|
|
5
|
+
async function readJSONFile(filename, encoding = 'utf-8') {
|
|
6
|
+
const text = await fs.readFile(filename, encoding);
|
|
7
7
|
return JSON.parse(text);
|
|
8
8
|
}
|
|
9
9
|
exports.readJSONFile = readJSONFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-json-file.js","sourceRoot":"","sources":["../../src/read-json-file.ts"],"names":[],"mappings":";;;AAAA,kCAAiC;AAE1B,KAAK,UAAU,YAAY,
|
|
1
|
+
{"version":3,"file":"read-json-file.js","sourceRoot":"","sources":["../../src/read-json-file.ts"],"names":[],"mappings":";;;AAAA,kCAAiC;AAE1B,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,WAA2B,OAAO;IAElC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAND,oCAMC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readNDJSONFileSync = void 0;
|
|
4
|
+
const iterable_operator_1 = require("iterable-operator");
|
|
5
|
+
const read_file_line_by_line_sync_1 = require("./read-file-line-by-line-sync");
|
|
6
|
+
const extra_utils_1 = require("extra-utils");
|
|
7
|
+
function readNDJSONFileSync(filename, encoding = 'utf-8') {
|
|
8
|
+
return (0, extra_utils_1.pipe)((0, read_file_line_by_line_sync_1.readFileLineByLineSync)(filename, encoding), iter => (0, iterable_operator_1.filter)(iter, line => line.trim() !== ''), iter => (0, iterable_operator_1.map)(iter, line => JSON.parse(line)));
|
|
9
|
+
}
|
|
10
|
+
exports.readNDJSONFileSync = readNDJSONFileSync;
|
|
11
|
+
//# sourceMappingURL=read-ndjson-file-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-ndjson-file-sync.js","sourceRoot":"","sources":["../../src/read-ndjson-file-sync.ts"],"names":[],"mappings":";;;AAAA,yDAA+C;AAC/C,+EAAsE;AACtE,6CAAkC;AAElC,SAAgB,kBAAkB,CAChC,QAAgB,EAChB,WAA2B,OAAO;IAElC,OAAO,IAAA,kBAAI,EACT,IAAA,oDAAsB,EAAC,QAAQ,EAAE,QAAQ,CAAC,EAC1C,IAAI,CAAC,EAAE,CAAC,IAAA,0BAAM,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAChD,IAAI,CAAC,EAAE,CAAC,IAAA,uBAAG,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAC5C,CAAA;AACH,CAAC;AATD,gDASC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readNDJSONFile = void 0;
|
|
4
|
+
const iterable_operator_1 = require("iterable-operator");
|
|
5
|
+
const read_file_line_by_line_1 = require("./read-file-line-by-line");
|
|
6
|
+
const extra_utils_1 = require("extra-utils");
|
|
7
|
+
function readNDJSONFile(filename, encoding = 'utf-8') {
|
|
8
|
+
return (0, extra_utils_1.pipe)((0, read_file_line_by_line_1.readFileLineByLine)(filename, encoding), iter => (0, iterable_operator_1.filterAsync)(iter, line => line.trim() !== ''), iter => (0, iterable_operator_1.mapAsync)(iter, line => JSON.parse(line)));
|
|
9
|
+
}
|
|
10
|
+
exports.readNDJSONFile = readNDJSONFile;
|
|
11
|
+
//# sourceMappingURL=read-ndjson-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-ndjson-file.js","sourceRoot":"","sources":["../../src/read-ndjson-file.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,qEAA6D;AAC7D,6CAAkC;AAElC,SAAgB,cAAc,CAC5B,QAAgB,EAChB,WAA2B,OAAO;IAElC,OAAO,IAAA,kBAAI,EACT,IAAA,2CAAkB,EAAC,QAAQ,EAAE,QAAQ,CAAC,EACtC,IAAI,CAAC,EAAE,CAAC,IAAA,+BAAW,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EACrD,IAAI,CAAC,EAAE,CAAC,IAAA,4BAAQ,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CACjD,CAAA;AACH,CAAC;AATD,wCASC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-filesystem",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
@@ -38,32 +38,33 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@blackglory/jest-matchers": "^0.
|
|
42
|
-
"@commitlint/cli": "^17.
|
|
43
|
-
"@commitlint/config-conventional": "^17.
|
|
41
|
+
"@blackglory/jest-matchers": "^0.5.0",
|
|
42
|
+
"@commitlint/cli": "^17.3.0",
|
|
43
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
44
44
|
"@types/fs-extra": "^9.0.13",
|
|
45
|
-
"@types/jest": "^
|
|
45
|
+
"@types/jest": "^29.2.3",
|
|
46
46
|
"@types/node": "14",
|
|
47
47
|
"@types/tmp": "^0.2.3",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
49
|
-
"@typescript-eslint/parser": "^5.
|
|
50
|
-
"eslint": "^8.
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
|
49
|
+
"@typescript-eslint/parser": "^5.44.0",
|
|
50
|
+
"eslint": "^8.28.0",
|
|
51
51
|
"husky": "^4.3.0",
|
|
52
|
-
"
|
|
53
|
-
"jest": "^
|
|
54
|
-
"jest-extended": "^2.0.0",
|
|
52
|
+
"jest": "^29.3.1",
|
|
53
|
+
"jest-extended": "^3.1.0",
|
|
55
54
|
"npm-run-all": "^4.1.5",
|
|
56
55
|
"return-style": "^1.0.0",
|
|
57
56
|
"rimraf": "^3.0.2",
|
|
58
57
|
"standard-version": "^9.5.0",
|
|
59
|
-
"ts-jest": "^
|
|
58
|
+
"ts-jest": "^29.0.3",
|
|
60
59
|
"tscpaths": "^0.0.9",
|
|
61
|
-
"typescript": "^4.
|
|
60
|
+
"typescript": "^4.9.3"
|
|
62
61
|
},
|
|
63
62
|
"dependencies": {
|
|
64
63
|
"@blackglory/pass": "^1.1.0",
|
|
65
|
-
"extra-promise": "^4.
|
|
64
|
+
"extra-promise": "^4.3.0",
|
|
65
|
+
"extra-utils": "^3.3.1",
|
|
66
66
|
"fs-extra": "^10.1.0",
|
|
67
|
+
"iterable-operator": "^2.5.0",
|
|
67
68
|
"tmp-promise": "^3.0.3"
|
|
68
69
|
}
|
|
69
70
|
}
|