@soga/utils 0.0.18 → 0.1.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/dist/charcode.d.ts +2 -2
- package/dist/level.d.ts +2 -2
- package/dist/level.js +1 -1
- package/package.json +4 -2
package/dist/charcode.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalyseResult } from 'chardet';
|
|
2
2
|
export declare const getFileAllCharcode: (filepath: string) => Promise<AnalyseResult>;
|
|
3
|
-
export declare const getFileCharcodeName: (filepath: string) => Promise<
|
|
4
|
-
export declare const getBufferCharcodeName: (buffer: Buffer<ArrayBufferLike>) =>
|
|
3
|
+
export declare const getFileCharcodeName: (filepath: string) => Promise<import("chardet").EncodingName>;
|
|
4
|
+
export declare const getBufferCharcodeName: (buffer: Buffer<ArrayBufferLike>) => import("chardet").EncodingName;
|
|
5
5
|
export declare const isUtf8File: (filepath: string) => Promise<boolean>;
|
|
6
6
|
export declare const saveFileAsUtf8: (inputFilePath: string, outputFilePath: string) => Promise<void>;
|
package/dist/level.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export declare const getUploadLevel: ({ outputRoot, input, }: {
|
|
|
3
3
|
outputRoot: string;
|
|
4
4
|
input: string;
|
|
5
5
|
}) => Promise<Level<string, LevelDataType>>;
|
|
6
|
-
export declare const getUploadPartLevel: ({ outputRoot, part_id, }: {
|
|
6
|
+
export declare const getUploadPartLevel: ({ outputRoot, part_id, host_type, }: {
|
|
7
7
|
outputRoot: string;
|
|
8
|
-
|
|
8
|
+
host_type: string;
|
|
9
9
|
part_id: number;
|
|
10
10
|
}) => Promise<Level<string, LevelDataType>>;
|
|
11
11
|
export declare const getDownloadLevel: ({ outputRoot, input, }: {
|
package/dist/level.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDownloadLevel=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 o=(0,path_1.resolve)(e,a),l=new level_1.Level(o,{valueEncoding:"json"});if(!await(0,fs_extra_1.exists)(t))return l;const r=await(0,file_1.getFileSize)(t),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDownloadLevel=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 o=(0,path_1.resolve)(e,a),l=new level_1.Level(o,{valueEncoding:"json"});if(!await(0,fs_extra_1.exists)(t))return l;const r=await(0,file_1.getFileSize)(t),s="__size__",i="__md4__",p=await l.get(s);if(!p){const e=await(0,hash_1.calculateMd4)({file:t,start:0,end:r-1});return await l.put(i,e),await l.put(s,r),l}if(p==r){if(await l.get(i)==await(0,hash_1.calculateMd4)({file:t,start:0,end:r-1}))return l}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 o=`upload_part_${a}_${t}`,l=(0,path_1.resolve)(e,o);return new level_1.Level(l,{valueEncoding:"json"})};exports.getUploadPartLevel=getUploadPartLevel;const getDownloadLevel=async({outputRoot:e,input:t})=>await getLevel({outputRoot:e,input:t,dbName:"download_store"});exports.getDownloadLevel=getDownloadLevel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soga/utils",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"glob": "^10.3.3",
|
|
37
37
|
"jest": "^29.6.3",
|
|
38
38
|
"prettier": "^3.0.2",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
39
40
|
"terser": "^5.19.2",
|
|
40
41
|
"ts-jest": "^29.1.1",
|
|
41
42
|
"ts-node": "^10.9.1",
|
|
@@ -50,5 +51,6 @@
|
|
|
50
51
|
"iconv-lite": "^0.6.3",
|
|
51
52
|
"langdetect": "^0.2.1",
|
|
52
53
|
"level": "^9.0.0"
|
|
53
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "9c477d59857bc4b74ae6479898b38b1444744144"
|
|
54
56
|
}
|