@soga/utils 0.1.1 → 0.1.13
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/dist/level.d.ts +0 -4
- package/dist/level.js +1 -1
- package/package.json +2 -2
package/dist/level.d.ts
CHANGED
|
@@ -8,9 +8,5 @@ export declare const getUploadPartLevel: ({ outputRoot, part_id, host_type, }: {
|
|
|
8
8
|
host_type: string;
|
|
9
9
|
part_id: number;
|
|
10
10
|
}) => Promise<Level<string, LevelDataType>>;
|
|
11
|
-
export declare const getDownloadLevel: ({ outputRoot, input, }: {
|
|
12
|
-
outputRoot: string;
|
|
13
|
-
input: string;
|
|
14
|
-
}) => Promise<Level<string, LevelDataType>>;
|
|
15
11
|
export type LevelDataType = string | number | object | boolean;
|
|
16
12
|
export type LevelDB = Level<string, LevelDataType>;
|
package/dist/level.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUploadPartLevel=exports.getUploadLevel=void 0;const level_1=require("level"),path_1=require("path"),file_1=require("./file"),hash_1=require("./hash"),fs_extra_1=require("fs-extra"),getLevel=async({outputRoot:e,input:t,dbName:a})=>{const l=(0,path_1.resolve)(e,a),o=new level_1.Level(l,{valueEncoding:"json"});if(!await(0,fs_extra_1.exists)(t))return o;const r=await(0,file_1.getFileSize)(t),i="__size__",s="__md4__",p=await o.get(i);if(!p){const e=await(0,hash_1.calculateMd4)({file:t,start:0,end:r-1});return await o.put(s,e),await o.put(i,r),o}if(p==r){if(await o.get(s)==await(0,hash_1.calculateMd4)({file:t,start:0,end:r-1}))return o}throw new Error("Conflict with last processed file")},getUploadLevel=async({outputRoot:e,input:t})=>await getLevel({outputRoot:e,input:t,dbName:"upload_store"});exports.getUploadLevel=getUploadLevel;const getUploadPartLevel=async({outputRoot:e,part_id:t,host_type:a})=>{const l=`upload_part_${a}_${t}`,o=(0,path_1.resolve)(e,l);return new level_1.Level(o,{valueEncoding:"json"})};exports.getUploadPartLevel=getUploadPartLevel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soga/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"langdetect": "^0.2.1",
|
|
53
53
|
"level": "^9.0.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "fd0b51d9ccc8001c61e746974666be04e72e5665"
|
|
56
56
|
}
|