qsu 1.9.0 → 1.9.2
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/README.md +15 -10
- package/dist/node/crypto/decrypt.js +1 -1
- package/dist/node/crypto/encrypt.js +1 -1
- package/dist/node/crypto/md5Hash.js +1 -1
- package/dist/node/crypto/sha1Hash.js +1 -1
- package/dist/node/crypto/sha256Hash.js +1 -1
- package/dist/node/file/createDirectory.js +1 -1
- package/dist/node/file/createFile.js +1 -1
- package/dist/node/file/createFileWithDummy.js +1 -1
- package/dist/node/file/deleteAllFileFromDirectory.js +1 -1
- package/dist/node/file/deleteFile.js +1 -1
- package/dist/node/file/getFileHash.js +1 -1
- package/dist/node/file/getFileInfo.js +1 -1
- package/dist/node/file/headFile.js +1 -1
- package/dist/node/file/isFileExists.js +1 -1
- package/dist/node/file/moveFile.js +1 -1
- package/dist/node/file/tailFile.js +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# qsu
|
|
3
|
+
# qsu - Quick & Simple Utility
|
|
4
4
|
|
|
5
|
-
[](https://github.com/jooy2/qsu/blob/main/LICENSE) ](https://github.com/jooy2/qsu/blob/main/LICENSE)  [](https://github.com/jooy2) 
|
|
6
6
|
|
|
7
|
-
**qsu** is
|
|
7
|
+
**qsu** is a library that collects frequently used utility functions. Streamline repetitive code with useful functions. Optimized for modern development environments, it supports various programming languages.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- Easy to install and use.
|
|
11
|
-
- 100% optimized for the latest Node.js and ESM environments.
|
|
12
|
-
- Useful features for websites and web applications
|
|
9
|
+
The following are the advantages of the qsu:
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
- Fast, lightweight bundle size
|
|
12
|
+
- Install and use easily.
|
|
13
|
+
- It is suitable for use on websites or applications.
|
|
14
|
+
- Documents, prepared for secure data types.
|
|
15
|
+
- Reduce defects through fast maintenance and various test cases.
|
|
16
|
+
- Support for multiple programming languages for the same operation. (JavaScript, Dart)
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
## Documentation
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Installing and using the package and defining all the utility methods can be found on the documentation page below.
|
|
21
|
+
|
|
22
|
+
- [Installation](https://qsu.cdget.com/installation/javascript)
|
|
23
|
+
- [Reference](https://qsu.cdget.com/reference)
|
|
19
24
|
|
|
20
25
|
## Contributing
|
|
21
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createDecipheriv as t}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{createCipheriv as t,randomBytes as n}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{createHash as t}from"
|
|
1
|
+
import{createHash as t}from"crypto";export function md5Hash(r){return t("md5").update(r).digest("hex")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as t}from"
|
|
1
|
+
import{createHash as t}from"crypto";export function sha1Hash(r){return t("sha1").update(r).digest("hex")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as t}from"
|
|
1
|
+
import{createHash as t}from"crypto";export function sha256Hash(r){return t("sha256").update(r).digest("hex")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdir as r}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{open as t,utimes as a}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{open as r}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{readdir as t}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{rm as e}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{createHash as
|
|
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 +1 @@
|
|
|
1
|
-
import{stat as e}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{readFile as r}from"
|
|
1
|
+
import{readFile as r}from"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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{access as r}from"
|
|
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 +1 @@
|
|
|
1
|
-
import{rename as o}from"
|
|
1
|
+
import{rename as o}from"fs/promises";export async function moveFile(i,e){i&&e&&await o(i,e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as t}from"
|
|
1
|
+
import{readFile as t}from"fs/promises";import{EOL as r}from"os";export async function tailFile(n,e=1){try{const l=(await t(n,"utf-8")).split(r);let o="";l[l.length-1].length<1&&l.pop();for(let t=l.length,r=l.length-e;t>r;t-=1)o=`${l[t-1]}${o.length<1||t-1===r?"":"\n"}${o}`;return o.length<1?null:o}catch(t){if(t instanceof Error)throw new Error(t.message)}return null}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "qsu is a
|
|
3
|
+
"version": "1.9.2",
|
|
4
|
+
"description": "qsu is a utility library that contains useful and frequently used functions. It contains useful functions for processing array, object, and string data. Start with your preferred programming language and the latest development environment.",
|
|
5
5
|
"author": "CDGet <jooy2.contact@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://qsu.cdget.com",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"tool",
|
|
59
59
|
"toolkit",
|
|
60
60
|
"underscore",
|
|
61
|
+
"web",
|
|
61
62
|
"website",
|
|
62
63
|
"helper",
|
|
63
64
|
"array",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"encrypt",
|
|
69
70
|
"decrypt",
|
|
70
71
|
"format",
|
|
72
|
+
"crypto",
|
|
71
73
|
"file"
|
|
72
74
|
],
|
|
73
75
|
"devDependencies": {
|