fsd 0.7.1 → 0.10.0

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  # fsd
2
+
2
3
  General file system driver for Node.js
3
4
 
4
- Document : https://github.com/maichong/fsd
5
+ Document : https://github.com/liangxingchen/fsd
package/index.d.ts CHANGED
@@ -49,7 +49,7 @@ export interface FSDFile {
49
49
  createReadStream(options?: ReadStreamOptions): Promise<NodeJS.ReadableStream>;
50
50
  createWriteStream(options?: WriteStreamOptions): Promise<NodeJS.WritableStream>;
51
51
  unlink(): Promise<void>;
52
- mkdir(prefix?: boolean): Promise<void>;
52
+ mkdir(recursive?: boolean): Promise<void>;
53
53
  readdir(recursion?: true | string): Promise<FSDFile[]>;
54
54
  createUrl(options?: CreateUrlOptions): Promise<string>;
55
55
  copy(dest: string): Promise<FSDFile>;
@@ -103,7 +103,7 @@ export class Adapter<T> {
103
103
  options?: WriteStreamOptions
104
104
  ): Promise<NodeJS.WritableStream & WithPromise>;
105
105
  unlink(path: string): Promise<void>;
106
- mkdir(path: string, prefix?: boolean): Promise<void>;
106
+ mkdir(path: string, recursive?: boolean): Promise<void>;
107
107
  readdir(
108
108
  path: string,
109
109
  recursion?: true | string | any
package/lib/file.js CHANGED
@@ -126,14 +126,14 @@ class FSDFile {
126
126
  this._lastModified = null;
127
127
  return this._adapter.unlink(this.path);
128
128
  }
129
- mkdir(prefix) {
129
+ mkdir(recursive) {
130
130
  debug('mkdir %s', this.path);
131
131
  if (!this.path.endsWith('/')) {
132
132
  throw new Error('mkdir failed, directory path should be ends with /');
133
133
  }
134
134
  this._size = null;
135
135
  this._lastModified = null;
136
- return this._adapter.mkdir(this.path, prefix);
136
+ return this._adapter.mkdir(this.path, recursive);
137
137
  }
138
138
  async readdir(recursion) {
139
139
  debug('readdir %s', this.path);
@@ -141,7 +141,10 @@ class FSDFile {
141
141
  throw new Error('readdir failed, directory path should be ends with /');
142
142
  }
143
143
  let files = await this._adapter.readdir(this.path, recursion);
144
- return files.map(({ name, metadata }) => new FSDFile(slash(Path.join(this.path, name)), this._adapter, metadata));
144
+ return files.map(({ name, metadata }) => {
145
+ let path = slash(Path.join(this.path, name));
146
+ return new FSDFile(path, this._adapter, metadata);
147
+ });
145
148
  }
146
149
  createUrl(options) {
147
150
  debug('createUrl %s', this.path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fsd",
3
- "version": "0.7.1",
3
+ "version": "0.10.0",
4
4
  "description": "General file system driver for Node.js",
5
5
  "main": "lib/fsd.js",
6
6
  "types": "index.d.ts",
@@ -8,13 +8,13 @@
8
8
  "build": "tsc",
9
9
  "prepublish": "npm run build"
10
10
  },
11
- "repository": "https://github.com/maichong/fsd/tree/master/packages/fsd",
12
- "author": "Liang <liang@maichong.it> (https://github.com/liangxingchen)",
11
+ "repository": "https://github.com/liangxingchen/fsd/tree/master/packages/fsd",
12
+ "author": "Liang <liang@miaomo.cc> (https://github.com/liangxingchen)",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "debug": "^4.3.1",
16
- "is-stream": "^2.0.0",
15
+ "debug": "^4.3.4",
16
+ "is-stream": "^2.0.1",
17
17
  "slash": "^3.0.0"
18
18
  },
19
- "gitHead": "867c73a70c5140405c9fa89c9ab423f575096854"
19
+ "gitHead": "9820fd7263b6791a38e5568396bfac0f2d3e37e9"
20
20
  }
package/tsconfig.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "removeComments": true,
5
- "preserveConstEnums": true,
6
- "outDir": "lib",
7
- "moduleResolution": "node",
8
- "baseUrl": ".",
9
- "paths": {
10
- "*": [
11
- "../../packages/*",
12
- "../../typings/*"
13
- ]
14
- },
15
- "target": "ES2017",
16
- "lib": [
17
- "es2017"
18
- ]
19
- },
20
- "include": [
21
- "src/**/*"
22
- ],
23
- "exclude": [
24
- "node_modules"
25
- ]
26
- }