fsd 0.14.0 → 0.14.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/lib/file.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Path = require("path");
4
- const slash = require("slash");
5
- const Debugger = require("debug");
6
- const isStream = require("is-stream");
3
+ const tslib_1 = require("tslib");
4
+ const path_1 = tslib_1.__importDefault(require("path"));
5
+ const slash_1 = tslib_1.__importDefault(require("slash"));
6
+ const debug_1 = tslib_1.__importDefault(require("debug"));
7
+ const is_stream_1 = tslib_1.__importDefault(require("is-stream"));
7
8
  const stream_1 = require("stream");
8
- const debug = Debugger('fsd');
9
+ const debug = (0, debug_1.default)('fsd');
9
10
  class FSDFile {
10
11
  constructor(pathOrFile, adapter, metadata) {
11
12
  if (!pathOrFile)
@@ -19,7 +20,7 @@ class FSDFile {
19
20
  this._adapter = adapter;
20
21
  this.needEnsureDir = adapter.needEnsureDir;
21
22
  this.path = path;
22
- let info = Path.parse(path);
23
+ let info = path_1.default.parse(path);
23
24
  this.dir = info.dir;
24
25
  if (this.dir !== '/') {
25
26
  this.dir += '/';
@@ -82,7 +83,7 @@ class FSDFile {
82
83
  this._lastModified = null;
83
84
  let stream = await this._adapter.createWriteStream(this.path);
84
85
  if (stream.promise) {
85
- if (isStream.readable(data)) {
86
+ if (is_stream_1.default.readable(data)) {
86
87
  data.pipe(stream);
87
88
  }
88
89
  else {
@@ -94,7 +95,7 @@ class FSDFile {
94
95
  await new Promise((resolve, reject) => {
95
96
  stream.on('error', reject);
96
97
  stream.on('finish', resolve);
97
- if (isStream.readable(data)) {
98
+ if (is_stream_1.default.readable(data)) {
98
99
  data.pipe(stream);
99
100
  }
100
101
  else {
@@ -140,7 +141,7 @@ class FSDFile {
140
141
  }
141
142
  let files = await this._adapter.readdir(this.path, recursion);
142
143
  return files.map(({ name, metadata }) => {
143
- let path = slash(Path.join(this.path, name));
144
+ let path = (0, slash_1.default)(path_1.default.join(this.path, name));
144
145
  return new FSDFile(path, this._adapter, metadata);
145
146
  });
146
147
  }
@@ -150,8 +151,8 @@ class FSDFile {
150
151
  }
151
152
  async copy(dest) {
152
153
  debug('copy %s to %s', this.path, dest);
153
- if (!Path.isAbsolute(dest)) {
154
- dest = slash(Path.join(Path.dirname(this.path), dest));
154
+ if (!path_1.default.isAbsolute(dest)) {
155
+ dest = (0, slash_1.default)(path_1.default.join(path_1.default.dirname(this.path), dest));
155
156
  }
156
157
  if (dest === this.path) {
157
158
  throw new Error('copy failed, dest path should not equal to source path');
@@ -227,7 +228,7 @@ class FSDFile {
227
228
  if (!task.startsWith('task:'))
228
229
  throw new Error('Invalid task link');
229
230
  let stream;
230
- if (isStream.readable(data)) {
231
+ if (is_stream_1.default.readable(data)) {
231
232
  stream = data;
232
233
  }
233
234
  else {
package/lib/fsd.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = FSD;
4
- const file_1 = require("./file");
4
+ const tslib_1 = require("tslib");
5
+ const file_1 = tslib_1.__importDefault(require("./file"));
5
6
  function FSD(options) {
6
7
  function fsd(path) {
7
8
  return new file_1.default(path, options.adapter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fsd",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "General file system driver for Node.js",
5
5
  "main": "lib/fsd.js",
6
6
  "types": "index.d.ts",
@@ -12,9 +12,8 @@
12
12
  "author": "Liang <liang@miaomo.cc> (https://github.com/liangxingchen)",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "debug": "^4.4.0",
15
+ "debug": "^4.4.3",
16
16
  "is-stream": "^2.0.1",
17
17
  "slash": "^3.0.0"
18
- },
19
- "gitHead": "74e32bf47242909f040eb6012dda56e5c5a668a0"
18
+ }
20
19
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 郑州渺漠信息科技有限公司
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, destribute, 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.