@secret-momo/utils 1.1.0 → 1.1.1

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/lib/file.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function fileSize(filePath: string): Promise<string>;
package/lib/file.js ADDED
@@ -0,0 +1 @@
1
+ import{statSync as r}from"node:fs";const o=["b","kb","mb","gb","tb"];function i(n){if(n<1024)return`${n}b`;const t=Math.min(Math.floor(Math.log(n)/Math.log(1024)),o.length-1);return`${(n/1024**t).toFixed(2)}${o[t]}`}async function e(n){const{size:t}=r(n);return i(t)}export{e as fileSize};
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './download';
2
2
  export * from './date-time';
3
3
  export * from './env';
4
4
  export * from './fetch';
5
+ export * from './file';
5
6
  export * from './num';
6
7
  export * from './pino';
7
8
  export * from './sleep';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{downloadImage as r,downloadVideo as t}from"./download/index.js";import{dateTimeToNow as f,dateToNow as a,timestampToDate as d,yesterdayDate as p}from"./date-time.js";import{getNodeName as g}from"./env.js";import{fetch as l,fetchHtml as n,fetchJson as s,fetchText as c,mobileUserAgent as u,userAgent as T}from"./fetch.js";import{fixed2 as w,fixed4 as N,toPercentage as y}from"./num.js";import{logger as A}from"./pino.js";import{sleep as I,sleep_random as P}from"./sleep.js";import{genId as b,uuidv4 as H}from"./uuid.js";import{getRedirectUrl as Q,removeQueryParams as R}from"./url.js";import{default as _}from"pino";export{f as dateTimeToNow,a as dateToNow,r as downloadImage,t as downloadVideo,l as fetch,n as fetchHtml,s as fetchJson,c as fetchText,w as fixed2,N as fixed4,b as genId,g as getNodeName,Q as getRedirectUrl,A as logger,u as mobileUserAgent,_ as pino,R as removeQueryParams,I as sleep,P as sleep_random,d as timestampToDate,y as toPercentage,T as userAgent,H as uuidv4,p as yesterdayDate};
1
+ import{downloadImage as r,downloadVideo as t}from"./download/index.js";import{dateTimeToNow as f,dateToNow as a,timestampToDate as d,yesterdayDate as p}from"./date-time.js";import{getNodeName as i}from"./env.js";import{fetch as g,fetchHtml as n,fetchJson as s,fetchText as c,mobileUserAgent as u,userAgent as T}from"./fetch.js";import{fileSize as w}from"./file.js";import{fixed2 as y,fixed4 as v,toPercentage as A}from"./num.js";import{logger as I}from"./pino.js";import{sleep as U,sleep_random as b}from"./sleep.js";import{genId as H,uuidv4 as J}from"./uuid.js";import{getRedirectUrl as R,removeQueryParams as S}from"./url.js";import{default as _}from"pino";export{f as dateTimeToNow,a as dateToNow,r as downloadImage,t as downloadVideo,g as fetch,n as fetchHtml,s as fetchJson,c as fetchText,w as fileSize,y as fixed2,v as fixed4,H as genId,i as getNodeName,R as getRedirectUrl,I as logger,u as mobileUserAgent,_ as pino,S as removeQueryParams,U as sleep,b as sleep_random,d as timestampToDate,A as toPercentage,T as userAgent,J as uuidv4,p as yesterdayDate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secret-momo/utils",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {