@waiting/shared-core
Advanced tools
Comparing version 23.6.1 to 23.7.0
@@ -62,2 +62,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
export declare function sleep(timeout?: number): Promise<void>; | ||
export declare function genRandomString(length?: number): string; | ||
//# sourceMappingURL=utils.d.ts.map |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import assert from 'node:assert'; | ||
import crypto from 'node:crypto'; | ||
import { access, } from 'node:fs'; | ||
@@ -126,3 +128,3 @@ import { mkdir, stat, writeFile, } from 'node:fs/promises'; | ||
if (!path) { | ||
throw new Error('File path empth '); | ||
throw new Error('File path empty '); | ||
} | ||
@@ -192,2 +194,10 @@ // only filename. can be loaded by search path such as %system% | ||
} | ||
export function genRandomString(length = 32) { | ||
assert(length > 0, 'length must be greater than 0'); | ||
// 生成随机字节 | ||
const randomBytes = crypto.randomBytes(Math.ceil(length / 2)); | ||
// 将字节转换为十六进制字符串 | ||
const randomString = randomBytes.toString('hex').slice(0, length); | ||
return randomString; | ||
} | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@waiting/shared-core", | ||
"author": "waiting", | ||
"version": "23.6.1", | ||
"version": "23.7.0", | ||
"description": "node core function re export with Promise or Observable", | ||
@@ -21,2 +21,3 @@ "keywords": [ | ||
".": "./dist/index.js", | ||
"./shell": "./dist/lib/shell/index.shell.js", | ||
"./package.json": "./package.json" | ||
@@ -37,7 +38,7 @@ }, | ||
"minimist": "^1.2.8", | ||
"semver": "^7.6.0", | ||
"semver": "^7.6.1", | ||
"zx": "^8.0.2" | ||
}, | ||
"devDependencies": { | ||
"undici": "^6.13.0" | ||
"undici": "^6.16.0" | ||
}, | ||
@@ -81,3 +82,3 @@ "engines": { | ||
}, | ||
"gitHead": "3d8ec3c261774680c5b62e87fd31965e9314026e" | ||
"gitHead": "0d4d29c322da460c4052d3aa2abbe9f974e08f9a" | ||
} |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import assert from 'node:assert' | ||
import crypto from 'node:crypto' | ||
import { | ||
@@ -163,3 +165,3 @@ access, | ||
if (! path) { | ||
throw new Error('File path empth ') | ||
throw new Error('File path empty ') | ||
} | ||
@@ -244,1 +246,10 @@ // only filename. can be loaded by search path such as %system% | ||
export function genRandomString(length = 32): string { | ||
assert(length > 0, 'length must be greater than 0') | ||
// 生成随机字节 | ||
const randomBytes = crypto.randomBytes(Math.ceil(length / 2)) | ||
// 将字节转换为十六进制字符串 | ||
const randomString = randomBytes.toString('hex').slice(0, length) | ||
return randomString | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154831
135
3128
Updatedsemver@^7.6.1