extra-filesystem 0.4.7 → 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 +24 -2
- 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-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/index.d.ts +2 -0
- package/lib/es2018/index.js +2 -0
- package/lib/es2018/index.js.map +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 +3 -2
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
|
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 +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"}
|
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 +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": [
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"@typescript-eslint/parser": "^5.44.0",
|
|
50
50
|
"eslint": "^8.28.0",
|
|
51
51
|
"husky": "^4.3.0",
|
|
52
|
-
"iterable-operator": "^2.5.0",
|
|
53
52
|
"jest": "^29.3.1",
|
|
54
53
|
"jest-extended": "^3.1.0",
|
|
55
54
|
"npm-run-all": "^4.1.5",
|
|
@@ -63,7 +62,9 @@
|
|
|
63
62
|
"dependencies": {
|
|
64
63
|
"@blackglory/pass": "^1.1.0",
|
|
65
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
|
}
|