@engine9-io/input-tools 1.7.4 → 1.7.5

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.
@@ -663,8 +663,33 @@ Worker.prototype.empty.metadata = {
663
663
  },
664
664
  };
665
665
 
666
+ Worker.prototype.remove = async function ({ filename }) {
667
+ if (!filename) throw new Error('filename is required');
668
+ if (typeof filename !== 'string') throw new Error(`filename isn't a string:${JSON.stringify(filename)}`);
669
+ if (filename.startsWith('s3://') || filename.startsWith('r2://')) {
670
+ let worker = null;
671
+ if (filename.startsWith('r2://')) {
672
+ worker = new R2Worker(this);
673
+ } else {
674
+ worker = new S3Worker(this);
675
+ }
676
+
677
+ await worker.remove({ filename });
678
+ } else {
679
+ fsp.unlink(filename);
680
+ }
681
+
682
+ return { removed: filename };
683
+ };
684
+ Worker.prototype.remove.metadata = {
685
+ options: {
686
+ filename: {},
687
+ },
688
+ };
689
+
666
690
  Worker.prototype.move = async function ({ filename, target }) {
667
691
  if (!target) throw new Error('target is required');
692
+ if (typeof target !== 'string') throw new Error(`target isn't a string:${JSON.stringify(target)}`);
668
693
  if (target.startsWith('s3://') || target.startsWith('r2://')) {
669
694
  if ((target.startsWith('s3://') && filename.startsWith('r2://'))
670
695
  || (target.startsWith('r2://') && filename.startsWith('s3://'))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engine9-io/input-tools",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "Tools for dealing with Engine9 inputs",
5
5
  "main": "index.js",
6
6
  "scripts": {