// npm 패키지
byte-parser
Parse byte string to byte number, e.g. 1.2 Kb -> 1228.8, Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb supported.
주간
3,018
월간
6,034
버전
1
메인테이너
1
라이선스
MIT
최초 publish
2020-09-15
publisher
atool
tarball
3,808 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2020-09-15
// publisher 캠페인by atool
이 계정에서 catch된 패키지 9건고립된 catch가 아닙니다. 동일 publisher가 8개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @1.0.0· no static-pattern hits
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s), 4 other host(s).
- @1.0.0··AUTO-PUBLISHED·publisher: atoolheuristic 75/100static flags 0llm benign (0.85) via ollamafirst-version-of-packagepopularity:highpublisher-multi-name-burst:5osv-flagged:MAL-2026-3846
→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s), 4 other host(s).
// offending code· no static-pattern hits
--- install scripts --- ### prepublishOnly npm run build --- package.json (entry) --- { "name": "byte-parser", "version": "1.0.0", "description": "Parse byte string to byte number, e.g. 1.2 Kb -> 1228.8, Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb supported.", "license": "MIT", "main": "lib/index.js", "files": [ "lib" ], "types": "lib/index.d.ts", "scripts": { "lint-staged": "lint-staged", "test": "jest", "build": "rimraf ./lib && tsc --module commonjs --outDir lib", "prepublishOnly": "npm run build" }, "keywords": [ "byte-parser", "parse-byte", "file-size", "size-parser" ], "devDependencies": { "@types/jest": "^26.0.13", "jest": "^26.4.2", "rimraf": "^3.0.2", "ts-jest": "^26.3.0", "typescript": "^3.9.7" }, "jest": { "preset": "ts-jest", "collectCoverage": true, "testRegex": "(/__tests__/.*\\.(test|spec))\\.ts$", "collectCoverageFrom": [ "src/**/*.ts" ] } } --- index.js (entry) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var MAP = { k: 1, m: 2, g: 3, t: 4, p: 5, e: 6, z: 7, y: 8, }; /** * parse byte string into a number * @param byteString */ function default_1(byteString, ratio) { if (ratio === void 0) { ratio = 1024; } var match = byteString.match(/^(\d*\.*\d*)\s*([kKmMgGtTpPeEzZyY]{0,1}[bB]{0,1})$/); if (!match) { throw "invalid byte string '" + byteString + "'!"; } var size = match[1]; var unit = match[2].toLowerCase().replace(/(b$)/, ''); // 删除最后的 b return size * Math.pow(ratio, MAP[unit] || 0); } exports.default = default_1;
