qsu 1.8.2 → 1.8.3

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.
@@ -1 +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)}}
1
+ import{mkdir as r}from"node:fs/promises";import{isFileExists as e}from"./isFileExists.js";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)}}
@@ -1 +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}}
1
+ import{open as r}from"node:fs/promises";import{createFile as e}from"./createFile.js";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}}
@@ -1 +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]))}
1
+ import{readdir as t}from"node: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 +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}}
1
+ import{stat as e}from"node:fs/promises";import{dirname as i,resolve as t}from"path";import{getFileExtension as r}from"./getFileExtension.js";import{getFileSize as o}from"./getFileSize.js";import{getFileName as s}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: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}}
@@ -1 +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
+ 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 +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)}
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 +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}
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 +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)}
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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
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",