@dnax/core 0.45.3 → 0.45.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/utils/index.ts +29 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.45.3",
3
+ "version": "0.45.4",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
package/utils/index.ts CHANGED
@@ -385,6 +385,33 @@ const password = {
385
385
  };
386
386
 
387
387
  const file = {
388
+ cp: async (src: string, des: string) => {
389
+ return new Promise(async (resolve, reject) => {
390
+ try {
391
+ await fs.copyFile(src, des);
392
+ let file = await Bun.file(des);
393
+ resolve({
394
+ original_name: file.name,
395
+ name: file.name,
396
+ lastModified: moment.unix(file.lastModified).toDate(),
397
+ size: file.size,
398
+ type: file.type,
399
+ });
400
+ } catch (err: any) {
401
+ reject(err?.message);
402
+ }
403
+ });
404
+ },
405
+ mv: async (source: string, destination: string) => {
406
+ return new Promise(async (resolve, reject) => {
407
+ try {
408
+ await fs.move(source, destination);
409
+ resolve(true);
410
+ } catch (err: any) {
411
+ reject(err?.message);
412
+ }
413
+ });
414
+ },
388
415
  exist: async (path: string): Promise<boolean> => {
389
416
  return new Promise(async (resolve, reject) => {
390
417
  try {
@@ -402,6 +429,7 @@ const file = {
402
429
  size: number;
403
430
  type: string;
404
431
  lastModified: Date;
432
+ original_name: string | undefined;
405
433
  name: string | undefined;
406
434
  }> => {
407
435
  // save to disk
@@ -412,6 +440,7 @@ const file = {
412
440
  });
413
441
  let file = await Bun.file(path);
414
442
  resolve({
443
+ original_name: file.name,
415
444
  name: file.name,
416
445
  lastModified: moment.unix(file.lastModified).toDate(),
417
446
  size: file.size,