qsu 1.7.1 → 1.8.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.
Files changed (96) hide show
  1. package/dist/format/numberFormat.js +1 -1
  2. package/dist/index.d.ts +0 -2
  3. package/dist/index.js +1 -1
  4. package/dist/server/crypto/decrypt.js +1 -0
  5. package/dist/server/crypto/encrypt.js +1 -0
  6. package/dist/server/crypto/index.d.ts +9 -0
  7. package/dist/server/crypto/index.js +1 -0
  8. package/dist/server/crypto/md5Hash.js +1 -0
  9. package/dist/server/crypto/sha1Hash.js +1 -0
  10. package/dist/server/crypto/sha256Hash.js +1 -0
  11. package/dist/server/file/createDirectory.js +1 -0
  12. package/dist/server/file/createFile.js +1 -0
  13. package/dist/server/file/createFileWithDummy.js +1 -0
  14. package/dist/server/file/deleteAllFileFromDirectory.js +1 -0
  15. package/dist/server/file/deleteFile.js +1 -0
  16. package/dist/server/file/getFileHash.js +1 -0
  17. package/dist/{file → server/file}/getFileInfo.d.ts +1 -1
  18. package/dist/server/file/getFileInfo.js +1 -0
  19. package/dist/server/file/getFilePathLevel.js +1 -0
  20. package/dist/{file → server/file}/getFileSize.d.ts +1 -1
  21. package/dist/server/file/getParentFilePath.js +1 -0
  22. package/dist/server/file/headFile.js +1 -0
  23. package/dist/server/file/index.d.ts +22 -0
  24. package/dist/server/file/index.js +1 -0
  25. package/dist/server/file/isFileExists.js +1 -0
  26. package/dist/server/file/isValidFileName.js +1 -0
  27. package/dist/server/file/joinFilePath.js +1 -0
  28. package/dist/server/file/moveFile.js +1 -0
  29. package/dist/server/file/tailFile.js +1 -0
  30. package/dist/server/index.d.ts +2 -0
  31. package/dist/server/index.js +1 -0
  32. package/package.json +1 -1
  33. package/dist/encrypt/decrypt.js +0 -1
  34. package/dist/encrypt/encrypt.js +0 -1
  35. package/dist/encrypt/index.d.ts +0 -9
  36. package/dist/encrypt/index.js +0 -1
  37. package/dist/encrypt/md5Hash.js +0 -1
  38. package/dist/encrypt/sha1Hash.js +0 -1
  39. package/dist/encrypt/sha256Hash.js +0 -1
  40. package/dist/file/createDirectory.js +0 -1
  41. package/dist/file/createFile.js +0 -1
  42. package/dist/file/createFileWithDummy.js +0 -1
  43. package/dist/file/deleteAllFileFromDirectory.js +0 -1
  44. package/dist/file/deleteFile.js +0 -1
  45. package/dist/file/getFileHash.js +0 -1
  46. package/dist/file/getFileInfo.js +0 -1
  47. package/dist/file/getFilePathLevel.js +0 -1
  48. package/dist/file/getParentFilePath.js +0 -1
  49. package/dist/file/headFile.js +0 -1
  50. package/dist/file/index.d.ts +0 -22
  51. package/dist/file/index.js +0 -1
  52. package/dist/file/isFileExists.js +0 -1
  53. package/dist/file/isValidFileName.js +0 -1
  54. package/dist/file/joinFilePath.js +0 -1
  55. package/dist/file/moveFile.js +0 -1
  56. package/dist/file/tailFile.js +0 -1
  57. /package/dist/{encrypt → server/crypto}/decodeBase64.d.ts +0 -0
  58. /package/dist/{encrypt → server/crypto}/decodeBase64.js +0 -0
  59. /package/dist/{encrypt → server/crypto}/decrypt.d.ts +0 -0
  60. /package/dist/{encrypt → server/crypto}/encodeBase64.d.ts +0 -0
  61. /package/dist/{encrypt → server/crypto}/encodeBase64.js +0 -0
  62. /package/dist/{encrypt → server/crypto}/encrypt.d.ts +0 -0
  63. /package/dist/{encrypt → server/crypto}/md5Hash.d.ts +0 -0
  64. /package/dist/{encrypt → server/crypto}/objectId.d.ts +0 -0
  65. /package/dist/{encrypt → server/crypto}/objectId.js +0 -0
  66. /package/dist/{encrypt → server/crypto}/sha1Hash.d.ts +0 -0
  67. /package/dist/{encrypt → server/crypto}/sha256Hash.d.ts +0 -0
  68. /package/dist/{encrypt → server/crypto}/strToNumberHash.d.ts +0 -0
  69. /package/dist/{encrypt → server/crypto}/strToNumberHash.js +0 -0
  70. /package/dist/{file → server/file}/createDirectory.d.ts +0 -0
  71. /package/dist/{file → server/file}/createFile.d.ts +0 -0
  72. /package/dist/{file → server/file}/createFileWithDummy.d.ts +0 -0
  73. /package/dist/{file → server/file}/deleteAllFileFromDirectory.d.ts +0 -0
  74. /package/dist/{file → server/file}/deleteFile.d.ts +0 -0
  75. /package/dist/{file → server/file}/getFileExtension.d.ts +0 -0
  76. /package/dist/{file → server/file}/getFileExtension.js +0 -0
  77. /package/dist/{file → server/file}/getFileHash.d.ts +0 -0
  78. /package/dist/{file → server/file}/getFileName.d.ts +0 -0
  79. /package/dist/{file → server/file}/getFileName.js +0 -0
  80. /package/dist/{file → server/file}/getFilePathLevel.d.ts +0 -0
  81. /package/dist/{file → server/file}/getFileSize.js +0 -0
  82. /package/dist/{file → server/file}/getParentFilePath.d.ts +0 -0
  83. /package/dist/{file → server/file}/headFile.d.ts +0 -0
  84. /package/dist/{file → server/file}/isFileExists.d.ts +0 -0
  85. /package/dist/{file → server/file}/isFileHidden.d.ts +0 -0
  86. /package/dist/{file → server/file}/isFileHidden.js +0 -0
  87. /package/dist/{file → server/file}/isValidFileName.d.ts +0 -0
  88. /package/dist/{file → server/file}/joinFilePath.d.ts +0 -0
  89. /package/dist/{file → server/file}/moveFile.d.ts +0 -0
  90. /package/dist/{file → server/file}/normalizeFile.d.ts +0 -0
  91. /package/dist/{file → server/file}/normalizeFile.js +0 -0
  92. /package/dist/{file → server/file}/tailFile.d.ts +0 -0
  93. /package/dist/{file → server/file}/toPosixFilePath.d.ts +0 -0
  94. /package/dist/{file → server/file}/toPosixFilePath.js +0 -0
  95. /package/dist/{file → server/file}/toValidFilePath.d.ts +0 -0
  96. /package/dist/{file → server/file}/toValidFilePath.js +0 -0
@@ -1 +1 @@
1
- export function numberFormat(r){return new Intl.NumberFormat("en-US",{roundingPriority:"morePrecision"}).format(r)}
1
+ export function numberFormat(t){const r="string"==typeof t?t.split("."):Math.abs(t).toString().split(".");return`${new Intl.NumberFormat("en-US",{roundingPriority:"morePrecision"}).format(parseInt(r[0],10))}${r.length>1?`.${r[1]}`:""}`}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from './array/index.js';
2
- export * from './encrypt/index.js';
3
2
  export * from './date/index.js';
4
- export * from './file/index.js';
5
3
  export * from './format/index.js';
6
4
  export * from './math/index.js';
7
5
  export * from './misc/index.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./array/index.js";export*from"./encrypt/index.js";export*from"./date/index.js";export*from"./file/index.js";export*from"./format/index.js";export*from"./math/index.js";export*from"./misc/index.js";export*from"./object/index.js";export*from"./string/index.js";export*from"./verify/index.js";export*from"./web/index.js";
1
+ export*from"./array/index.js";export*from"./date/index.js";export*from"./format/index.js";export*from"./math/index.js";export*from"./misc/index.js";export*from"./object/index.js";export*from"./string/index.js";export*from"./verify/index.js";export*from"./web/index.js";
@@ -0,0 +1 @@
1
+ import{createDecipheriv as t}from"node:crypto";export function decrypt(r,e,f="aes-256-cbc",o=!1){if(!r||r.length<1)return"";const n=o?"base64":"hex",c=r.split(":"),i=t(f,e,Buffer.from(c.shift(),n));let u=i.update(Buffer.from(c.join(":"),n));return u=Buffer.concat([u,i.final()]),u.toString()}
@@ -0,0 +1 @@
1
+ import{createCipheriv as t,randomBytes as n}from"node:crypto";export function encrypt(e,r,o="aes-256-cbc",c=16,f=!1){if(!e||e.length<1)return"";const i=n(c),a=t(o,r,i);let p=a.update(e);p=Buffer.concat([p,a.final()]);const u=f?"base64":"hex";return`${i.toString(u)}:${p.toString(u)}`}
@@ -0,0 +1,9 @@
1
+ export { decodeBase64 } from './decodeBase64';
2
+ export { decrypt } from './decrypt';
3
+ export { encodeBase64 } from './encodeBase64';
4
+ export { encrypt } from './encrypt';
5
+ export { md5Hash } from './md5Hash';
6
+ export { objectId } from './objectId';
7
+ export { sha1Hash } from './sha1Hash';
8
+ export { sha256Hash } from './sha256Hash';
9
+ export { strToNumberHash } from './strToNumberHash';
@@ -0,0 +1 @@
1
+ export{decodeBase64}from"./decodeBase64";export{decrypt}from"./decrypt";export{encodeBase64}from"./encodeBase64";export{encrypt}from"./encrypt";export{md5Hash}from"./md5Hash";export{objectId}from"./objectId";export{sha1Hash}from"./sha1Hash";export{sha256Hash}from"./sha256Hash";export{strToNumberHash}from"./strToNumberHash";
@@ -0,0 +1 @@
1
+ import{createHash as t}from"node:crypto";export function md5Hash(e){return t("md5").update(e).digest("hex")}
@@ -0,0 +1 @@
1
+ import{createHash as t}from"node:crypto";export function sha1Hash(e){return t("sha1").update(e).digest("hex")}
@@ -0,0 +1 @@
1
+ import{createHash as t}from"node:crypto";export function sha256Hash(e){return t("sha256").update(e).digest("hex")}
@@ -0,0 +1 @@
1
+ import{mkdir as r}from"node:fs/promises";import{isFileExists as e}from"./isFileExists";export async function createDirectory(i,o=!0){try{await e(i)||await r(i,{recursive:o})}catch(r){if(r instanceof Error)throw new Error(r.message)}}
@@ -0,0 +1 @@
1
+ import{open as t,utimes as a}from"node:fs/promises";export async function createFile(e){if(!e)return;const o=new Date;try{await a(e,o,o)}catch(a){const o=await t(e,"a");await o.close()}}
@@ -0,0 +1 @@
1
+ import{open as r}from"node:fs/promises";import{createFile as e}from"./createFile";export async function createFileWithDummy(t,i){if(!i||i<0)throw new Error("Size is required");try{if(0===i)return await e(t),!0;const a=await r(t,"w");return await a.write(Buffer.alloc(1),0,1,i-1),await a.close(),!0}catch(r){return!1}}
@@ -0,0 +1 @@
1
+ import{readdir as t}from"node:fs/promises";import{join as e}from"path";import{deleteFile as o}from"./deleteFile";export async function deleteAllFileFromDirectory(r){let i=[];try{i=await t(r)}catch{}const l=i.length;for(let t=0;t<l;t+=1)await o(e(r,i[t]))}
@@ -0,0 +1 @@
1
+ import{rm as e}from"node:fs/promises";export async function deleteFile(r){if(r)try{await e(r,{recursive:!0,force:!0})}catch{}}
@@ -0,0 +1 @@
1
+ import{createHash as o}from"node:crypto";import{createReadStream as r}from"node:fs";export async function getFileHash(e,n="md5"){return new Promise(((t,d)=>{if(!e)return void d(new Error("Invalid path"));const i=o(n),a=r(e);a.on("error",(o=>{d(o)})),a.on("data",(o=>{i.update(o)})),a.on("end",(()=>{t(i.digest("hex"))}))}))}
@@ -1,2 +1,2 @@
1
- import { FileInfo } from '../_types/global';
1
+ import { FileInfo } from '../../_types/global';
2
2
  export declare function getFileInfo(filePath: string): Promise<FileInfo>;
@@ -0,0 +1 @@
1
+ import{stat as e}from"node:fs/promises";import{dirname as i,resolve as t}from"path";import{getFileExtension as r}from"./getFileExtension";import{getFileSize as o}from"./getFileSize";import{getFileName as s}from"./getFileName";export async function getFileInfo(m){const n=e=>Math.floor(new Date(e).getTime()/1e3);try{const a=await e(m);return{success:!0,isDirectory:a.isDirectory(),ext:r(m),size:a.size,sizeHumanized:o(a.size),name:s(m),dirname:i(m),path:t(m),created:n(a.ctime),modified:n(a.mtime)}}catch(e){if(e instanceof Error)throw new Error(e.message)}return{success:!1,isDirectory:!1,ext:null,size:0,sizeHumanized:"0 Bytes",name:"unknown",dirname:i(m),path:m,created:-1,modified:-1}}
@@ -0,0 +1 @@
1
+ import{posix as t}from"path";import{toPosixFilePath as e}from"./toPosixFilePath";export function getFilePathLevel(o){return o?"/"===o?1:e(o.replace(/\\+$/,"")).split(t.sep).length:-1}
@@ -1,2 +1,2 @@
1
- import type { PositiveNumber } from '../_types/global';
1
+ import type { PositiveNumber } from '../../_types/global';
2
2
  export declare function getFileSize<N extends number>(bytes: PositiveNumber<N>, decimals?: number): string;
@@ -0,0 +1 @@
1
+ import{toValidFilePath as t}from"./toValidFilePath";export function getParentFilePath(e,o){const i=e.split(o?"\\":"/");let n;return i.pop(),n=1===i.length?o?"C:\\":"/":i.join(o?"\\":"/"),t(n,o)}
@@ -0,0 +1 @@
1
+ import{readFile as r}from"node:fs/promises";import{EOL as t}from"os";export async function headFile(o,e=1){try{const n=(await r(o,"utf-8")).split(t);let s="";for(let r=0,t=e;r<t;r+=1)s+=`${n[r]}${e<2||r===t-1?"":"\n"}`;return s.length<1?null:s}catch(r){if(r instanceof Error)throw new Error(r.message)}return null}
@@ -0,0 +1,22 @@
1
+ export { createDirectory } from './createDirectory';
2
+ export { createFile } from './createFile';
3
+ export { createFileWithDummy } from './createFileWithDummy';
4
+ export { deleteAllFileFromDirectory } from './deleteAllFileFromDirectory';
5
+ export { deleteFile } from './deleteFile';
6
+ export { getFileExtension } from './getFileExtension';
7
+ export { getFileHash } from './getFileHash';
8
+ export { getFileInfo } from './getFileInfo';
9
+ export { getFileName } from './getFileName';
10
+ export { getFilePathLevel } from './getFilePathLevel';
11
+ export { getFileSize } from './getFileSize';
12
+ export { getParentFilePath } from './getParentFilePath';
13
+ export { headFile } from './headFile';
14
+ export { isFileExists } from './isFileExists';
15
+ export { isFileHidden } from './isFileHidden';
16
+ export { isValidFileName } from './isValidFileName';
17
+ export { joinFilePath } from './joinFilePath';
18
+ export { moveFile } from './moveFile';
19
+ export { normalizeFile } from './normalizeFile';
20
+ export { tailFile } from './tailFile';
21
+ export { toPosixFilePath } from './toPosixFilePath';
22
+ export { toValidFilePath } from './toValidFilePath';
@@ -0,0 +1 @@
1
+ export{createDirectory}from"./createDirectory";export{createFile}from"./createFile";export{createFileWithDummy}from"./createFileWithDummy";export{deleteAllFileFromDirectory}from"./deleteAllFileFromDirectory";export{deleteFile}from"./deleteFile";export{getFileExtension}from"./getFileExtension";export{getFileHash}from"./getFileHash";export{getFileInfo}from"./getFileInfo";export{getFileName}from"./getFileName";export{getFilePathLevel}from"./getFilePathLevel";export{getFileSize}from"./getFileSize";export{getParentFilePath}from"./getParentFilePath";export{headFile}from"./headFile";export{isFileExists}from"./isFileExists";export{isFileHidden}from"./isFileHidden";export{isValidFileName}from"./isValidFileName";export{joinFilePath}from"./joinFilePath";export{moveFile}from"./moveFile";export{normalizeFile}from"./normalizeFile";export{tailFile}from"./tailFile";export{toPosixFilePath}from"./toPosixFilePath";export{toValidFilePath}from"./toValidFilePath";
@@ -0,0 +1 @@
1
+ import{access as r}from"node:fs/promises";import{constants as t}from"node:fs";export async function isFileExists(o){try{return await r(o,t.F_OK),!0}catch(r){return!1}}
@@ -0,0 +1 @@
1
+ import{getFileName as e}from"./getFileName";export function isValidFileName(t,i){let l;const n=e(t);return l=i?/(^\s+$)|(^\.+$)|([:/]+)/:/(^\s+$)|(^\.+$)|([<>:"/\\|?*]+)/,!l.test(n)&&n.length<=255}
@@ -0,0 +1 @@
1
+ import{posix as o,win32 as i}from"path";import{toValidFilePath as t}from"./toValidFilePath";export function joinFilePath(r,...n){return r?t(i.join(...n),!0):t(o.join(...n),!1)}
@@ -0,0 +1 @@
1
+ import{rename as o}from"node:fs/promises";export async function moveFile(e,i){e&&i&&await o(e,i)}
@@ -0,0 +1 @@
1
+ import{readFile as t}from"node:fs/promises";import{EOL as n}from"os";export async function tailFile(r,e=1){try{const o=(await t(r,"utf-8")).split(n);let l="";o[o.length-1].length<1&&o.pop();for(let t=o.length,n=o.length-e;t>n;t-=1)l=`${o[t-1]}${l.length<1||t-1===n?"":"\n"}${l}`;return l.length<1?null:l}catch(t){if(t instanceof Error)throw new Error(t.message)}return null}
@@ -0,0 +1,2 @@
1
+ export * from './file/index.js';
2
+ export * from './crypto/index.js';
@@ -0,0 +1 @@
1
+ export*from"./file/index.js";export*from"./crypto/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "qsu is a lightweight and simple module with a variety of built-in utility functions that you can utilize in your Node.js projects.",
5
5
  "author": "CDGet <jooy2.contact@gmail.com>",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{createDecipheriv as t}from"crypto";export function decrypt(r,e,f="aes-256-cbc",o=!1){if(!r||r.length<1)return"";const n=o?"base64":"hex",c=r.split(":"),i=t(f,e,Buffer.from(c.shift(),n));let u=i.update(Buffer.from(c.join(":"),n));return u=Buffer.concat([u,i.final()]),u.toString()}
@@ -1 +0,0 @@
1
- import{createCipheriv as t,randomBytes as n}from"crypto";export function encrypt(r,e,o="aes-256-cbc",c=16,f=!1){if(!r||r.length<1)return"";const i=n(c),a=t(o,e,i);let p=a.update(r);p=Buffer.concat([p,a.final()]);const u=f?"base64":"hex";return`${i.toString(u)}:${p.toString(u)}`}
@@ -1,9 +0,0 @@
1
- export { decodeBase64 } from './decodeBase64.js';
2
- export { decrypt } from './decrypt.js';
3
- export { encodeBase64 } from './encodeBase64.js';
4
- export { encrypt } from './encrypt.js';
5
- export { md5Hash } from './md5Hash.js';
6
- export { objectId } from './objectId.js';
7
- export { sha1Hash } from './sha1Hash.js';
8
- export { sha256Hash } from './sha256Hash.js';
9
- export { strToNumberHash } from './strToNumberHash.js';
@@ -1 +0,0 @@
1
- export{decodeBase64}from"./decodeBase64.js";export{decrypt}from"./decrypt.js";export{encodeBase64}from"./encodeBase64.js";export{encrypt}from"./encrypt.js";export{md5Hash}from"./md5Hash.js";export{objectId}from"./objectId.js";export{sha1Hash}from"./sha1Hash.js";export{sha256Hash}from"./sha256Hash.js";export{strToNumberHash}from"./strToNumberHash.js";
@@ -1 +0,0 @@
1
- import{createHash as t}from"crypto";export function md5Hash(r){return t("md5").update(r).digest("hex")}
@@ -1 +0,0 @@
1
- import{createHash as t}from"crypto";export function sha1Hash(r){return t("sha1").update(r).digest("hex")}
@@ -1 +0,0 @@
1
- import{createHash as t}from"crypto";export function sha256Hash(r){return t("sha256").update(r).digest("hex")}
@@ -1 +0,0 @@
1
- import{mkdir as r}from"fs/promises";import{isFileExists as i}from"./isFileExists.js";export async function createDirectory(t,e=!0){try{await i(t)||await r(t,{recursive:e})}catch(r){if(r instanceof Error)throw new Error(r.message)}}
@@ -1 +0,0 @@
1
- import{open as t,utimes as a}from"fs/promises";export async function createFile(e){if(!e)return;const c=new Date;try{await a(e,c,c)}catch(a){const c=await t(e,"a");await c.close()}}
@@ -1 +0,0 @@
1
- import{open as r}from"fs/promises";import{createFile as t}from"./createFile.js";export async function createFileWithDummy(e,i){if(!i||i<0)throw new Error("Size is required");try{if(0===i)return await t(e),!0;const a=await r(e,"w");return await a.write(Buffer.alloc(1),0,1,i-1),await a.close(),!0}catch(r){return!1}}
@@ -1 +0,0 @@
1
- import{readdir as t}from"fs/promises";import{join as e}from"path";import{deleteFile as o}from"./deleteFile.js";export async function deleteAllFileFromDirectory(r){let i=[];try{i=await t(r)}catch{}const l=i.length;for(let t=0;t<l;t+=1)await o(e(r,i[t]))}
@@ -1 +0,0 @@
1
- import{rm as e}from"fs/promises";export async function deleteFile(r){if(r)try{await e(r,{recursive:!0,force:!0})}catch{}}
@@ -1 +0,0 @@
1
- import{createHash as r}from"crypto";import{createReadStream as o}from"fs";export async function getFileHash(e,n="md5"){return new Promise(((t,i)=>{if(!e)return void i(new Error("Invalid path"));const a=r(n),d=o(e);d.on("error",(r=>{i(r)})),d.on("data",(r=>{a.update(r)})),d.on("end",(()=>{t(a.digest("hex"))}))}))}
@@ -1 +0,0 @@
1
- import{stat as e}from"fs/promises";import{dirname as i,resolve as t}from"path";import{getFileExtension as r}from"./getFileExtension.js";import{getFileSize as s}from"./getFileSize.js";import{getFileName as o}from"./getFileName.js";export async function getFileInfo(m){const n=e=>Math.floor(new Date(e).getTime()/1e3);try{const a=await e(m);return{success:!0,isDirectory:a.isDirectory(),ext:r(m),size:a.size,sizeHumanized:s(a.size),name:o(m),dirname:i(m),path:t(m),created:n(a.ctime),modified:n(a.mtime)}}catch(e){if(e instanceof Error)throw new Error(e.message)}return{success:!1,isDirectory:!1,ext:null,size:0,sizeHumanized:"0 Bytes",name:"unknown",dirname:i(m),path:m,created:-1,modified:-1}}
@@ -1 +0,0 @@
1
- import{posix as t}from"path";import{toPosixFilePath as e}from"./toPosixFilePath.js";export function getFilePathLevel(o){return o?"/"===o?1:e(o.replace(/\\+$/,"")).split(t.sep).length:-1}
@@ -1 +0,0 @@
1
- import{toValidFilePath as t}from"./toValidFilePath.js";export function getParentFilePath(e,o){const i=e.split(o?"\\":"/");let n;return i.pop(),n=1===i.length?o?"C:\\":"/":i.join(o?"\\":"/"),t(n,o)}
@@ -1 +0,0 @@
1
- import{readFile as r}from"fs/promises";export async function headFile(t,n=1){try{const e=(await r(t,"utf-8")).split("\n");let o="";for(let r=0,t=n;r<t;r+=1)o+=`${e[r]}${n<2||r===t-1?"":"\n"}`;return o.length<1?null:o}catch(r){if(r instanceof Error)throw new Error(r.message)}return null}
@@ -1,22 +0,0 @@
1
- export { createDirectory } from './createDirectory.js';
2
- export { createFile } from './createFile.js';
3
- export { createFileWithDummy } from './createFileWithDummy.js';
4
- export { deleteAllFileFromDirectory } from './deleteAllFileFromDirectory.js';
5
- export { deleteFile } from './deleteFile.js';
6
- export { getFileExtension } from './getFileExtension.js';
7
- export { getFileHash } from './getFileHash.js';
8
- export { getFileInfo } from './getFileInfo.js';
9
- export { getFileName } from './getFileName.js';
10
- export { getFilePathLevel } from './getFilePathLevel.js';
11
- export { getFileSize } from './getFileSize.js';
12
- export { getParentFilePath } from './getParentFilePath.js';
13
- export { headFile } from './headFile.js';
14
- export { isFileExists } from './isFileExists.js';
15
- export { isFileHidden } from './isFileHidden.js';
16
- export { isValidFileName } from './isValidFileName.js';
17
- export { joinFilePath } from './joinFilePath.js';
18
- export { moveFile } from './moveFile.js';
19
- export { normalizeFile } from './normalizeFile.js';
20
- export { tailFile } from './tailFile.js';
21
- export { toPosixFilePath } from './toPosixFilePath.js';
22
- export { toValidFilePath } from './toValidFilePath.js';
@@ -1 +0,0 @@
1
- export{createDirectory}from"./createDirectory.js";export{createFile}from"./createFile.js";export{createFileWithDummy}from"./createFileWithDummy.js";export{deleteAllFileFromDirectory}from"./deleteAllFileFromDirectory.js";export{deleteFile}from"./deleteFile.js";export{getFileExtension}from"./getFileExtension.js";export{getFileHash}from"./getFileHash.js";export{getFileInfo}from"./getFileInfo.js";export{getFileName}from"./getFileName.js";export{getFilePathLevel}from"./getFilePathLevel.js";export{getFileSize}from"./getFileSize.js";export{getParentFilePath}from"./getParentFilePath.js";export{headFile}from"./headFile.js";export{isFileExists}from"./isFileExists.js";export{isFileHidden}from"./isFileHidden.js";export{isValidFileName}from"./isValidFileName.js";export{joinFilePath}from"./joinFilePath.js";export{moveFile}from"./moveFile.js";export{normalizeFile}from"./normalizeFile.js";export{tailFile}from"./tailFile.js";export{toPosixFilePath}from"./toPosixFilePath.js";export{toValidFilePath}from"./toValidFilePath.js";
@@ -1 +0,0 @@
1
- import{access as r}from"fs/promises";import{constants as t}from"fs";export async function isFileExists(i){try{return await r(i,t.F_OK),!0}catch(r){return!1}}
@@ -1 +0,0 @@
1
- import{getFileName as e}from"./getFileName.js";export function isValidFileName(t,i){let s;const l=e(t);return s=i?/(^\s+$)|(^\.+$)|([:/]+)/:/(^\s+$)|(^\.+$)|([<>:"/\\|?*]+)/,!s.test(l)&&l.length<=255}
@@ -1 +0,0 @@
1
- import{posix as o,win32 as i}from"path";import{toValidFilePath as t}from"./toValidFilePath.js";export function joinFilePath(r,...n){return r?t(i.join(...n),!0):t(o.join(...n),!1)}
@@ -1 +0,0 @@
1
- import{rename as o}from"fs/promises";export async function moveFile(i,e){i&&e&&await o(i,e)}
@@ -1 +0,0 @@
1
- import{readFile as t}from"fs/promises";export async function tailFile(n,e=1){try{const r=(await t(n,"utf-8")).split("\n");let l="";r[r.length-1].length<1&&r.pop();for(let t=r.length,n=r.length-e;t>n;t-=1)l=`${r[t-1]}${l.length<1||t-1===n?"":"\n"}${l}`;return l.length<1?null:l}catch(t){if(t instanceof Error)throw new Error(t.message)}return null}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes