@soga/utils 0.2.15 → 0.2.22
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/package.json +3 -4
- package/dist/level.d.ts +0 -12
- package/dist/level.js +0 -1
- package/dist/store.d.ts +0 -3
- package/dist/store.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soga/utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
"chardet": "^2.0.0",
|
|
50
50
|
"fs-extra": "^11.2.0",
|
|
51
51
|
"iconv-lite": "^0.6.3",
|
|
52
|
-
"langdetect": "^0.2.1"
|
|
53
|
-
"level": "^9.0.0"
|
|
52
|
+
"langdetect": "^0.2.1"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "6a9ab21995f575fd1325a2b5fa7eea4fd50564db"
|
|
56
55
|
}
|
package/dist/level.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Level } from 'level';
|
|
2
|
-
export declare const getUploadLevel: ({ outputRoot, input, }: {
|
|
3
|
-
outputRoot: string;
|
|
4
|
-
input: string;
|
|
5
|
-
}) => Promise<Level<string, LevelDataType>>;
|
|
6
|
-
export declare const getUploadPartLevel: ({ outputRoot, part_id, host_type, }: {
|
|
7
|
-
outputRoot: string;
|
|
8
|
-
host_type: string;
|
|
9
|
-
part_id: number;
|
|
10
|
-
}) => Promise<Level<string, LevelDataType>>;
|
|
11
|
-
export type LevelDataType = string | number | object | boolean;
|
|
12
|
-
export type LevelDB = Level<string, LevelDataType>;
|
package/dist/level.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/dist/store.d.ts
DELETED
package/dist/store.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUploadStore=void 0;const level_1=require("level"),path_1=require("path"),getUploadStore=async e=>{const t=(0,path_1.resolve)(e,"upload_store");return new level_1.Level(t,{valueEncoding:"json"})};exports.getUploadStore=getUploadStore;
|