1 | "use strict";
|
2 | var __assign = (this && this.__assign) || function () {
|
3 | __assign = Object.assign || function(t) {
|
4 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5 | s = arguments[i];
|
6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7 | t[p] = s[p];
|
8 | }
|
9 | return t;
|
10 | };
|
11 | return __assign.apply(this, arguments);
|
12 | };
|
13 | Object.defineProperty(exports, "__esModule", { value: true });
|
14 | exports.fs = exports.createFsFromVolume = exports.vol = exports.Volume = void 0;
|
15 | var Stats_1 = require("./Stats");
|
16 | var Dirent_1 = require("./Dirent");
|
17 | var volume_1 = require("./volume");
|
18 |
|
19 | var fsProps = ['constants', 'F_OK', 'R_OK', 'W_OK', 'X_OK', 'Stats'];
|
20 | var fsSyncMethods = ['renameSync', 'ftruncateSync', 'truncateSync', 'chownSync', 'fchownSync', 'lchownSync', 'chmodSync', 'fchmodSync', 'lchmodSync', 'statSync', 'lstatSync', 'fstatSync', 'linkSync', 'symlinkSync', 'readlinkSync', 'realpathSync', 'unlinkSync', 'rmdirSync', 'mkdirSync', 'mkdirpSync', 'readdirSync', 'closeSync', 'openSync', 'utimesSync', 'futimesSync', 'fsyncSync', 'writeSync', 'readSync', 'readFileSync', 'writeFileSync', 'appendFileSync', 'existsSync', 'accessSync', 'fdatasyncSync', 'mkdtempSync', 'copyFileSync', 'createReadStream', 'createWriteStream'];
|
21 | var fsAsyncMethods = ['rename', 'ftruncate', 'truncate', 'chown', 'fchown', 'lchown', 'chmod', 'fchmod', 'lchmod', 'stat', 'lstat', 'fstat', 'link', 'symlink', 'readlink', 'realpath', 'unlink', 'rmdir', 'mkdir', 'mkdirp', 'readdir', 'close', 'open', 'utimes', 'futimes', 'fsync', 'write', 'read', 'readFile', 'writeFile', 'appendFile', 'exists', 'access', 'fdatasync', 'mkdtemp', 'copyFile', 'watchFile', 'unwatchFile', 'watch'];
|
22 | var constants_1 = require("./constants");
|
23 | var F_OK = constants_1.constants.F_OK, R_OK = constants_1.constants.R_OK, W_OK = constants_1.constants.W_OK, X_OK = constants_1.constants.X_OK;
|
24 | exports.Volume = volume_1.Volume;
|
25 |
|
26 | exports.vol = new volume_1.Volume();
|
27 | function createFsFromVolume(vol) {
|
28 | var fs = { F_OK: F_OK, R_OK: R_OK, W_OK: W_OK, X_OK: X_OK, constants: constants_1.constants, Stats: Stats_1.default, Dirent: Dirent_1.default };
|
29 |
|
30 | for (var _i = 0, fsSyncMethods_1 = fsSyncMethods; _i < fsSyncMethods_1.length; _i++) {
|
31 | var method = fsSyncMethods_1[_i];
|
32 | if (typeof vol[method] === 'function')
|
33 | fs[method] = vol[method].bind(vol);
|
34 | }
|
35 | for (var _a = 0, fsAsyncMethods_1 = fsAsyncMethods; _a < fsAsyncMethods_1.length; _a++) {
|
36 | var method = fsAsyncMethods_1[_a];
|
37 | if (typeof vol[method] === 'function')
|
38 | fs[method] = vol[method].bind(vol);
|
39 | }
|
40 | fs.StatWatcher = vol.StatWatcher;
|
41 | fs.FSWatcher = vol.FSWatcher;
|
42 | fs.WriteStream = vol.WriteStream;
|
43 | fs.ReadStream = vol.ReadStream;
|
44 | fs.promises = vol.promises;
|
45 | fs._toUnixTimestamp = volume_1.toUnixTimestamp;
|
46 | return fs;
|
47 | }
|
48 | exports.createFsFromVolume = createFsFromVolume;
|
49 | exports.fs = createFsFromVolume(exports.vol);
|
50 | module.exports = __assign(__assign({}, module.exports), exports.fs);
|
51 | module.exports.semantic = true;
|