@engine9-io/input-tools 1.5.1 → 1.5.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.
@@ -661,7 +661,12 @@ Worker.prototype.move = async function ({ filename, target }) {
661
661
  throw new Error('Cowardly not copying between services');
662
662
  }
663
663
 
664
- const worker = new (filename.startsWith('r2://') ? R2Worker : S3Worker)(this);
664
+ let worker = null;
665
+ if (target.startsWith('r2://')) {
666
+ worker = new R2Worker(this);
667
+ } else {
668
+ worker = new S3Worker(this);
669
+ }
665
670
 
666
671
  if (filename.startsWith('s3://') || filename.startsWith('r2://')) {
667
672
  // We need to copy and delete
package/file/S3.js CHANGED
@@ -131,7 +131,8 @@ Worker.prototype.download.metadata = {
131
131
  Worker.prototype.put = async function (options) {
132
132
  const { filename, directory } = options;
133
133
  if (!filename) throw new Error('Local filename required');
134
- if (directory?.indexOf('s3://') !== 0) throw new Error(`directory path must start with s3://, is ${directory}`);
134
+ if (directory?.indexOf('s3://') !== 0
135
+ && directory?.indexOf('r2://') !== 0) throw new Error(`directory path must start with s3:// or r2://, is ${directory}`);
135
136
 
136
137
  const file = options.file || filename.split('/').pop();
137
138
  const parts = directory.split('/');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engine9-io/input-tools",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Tools for dealing with Engine9 inputs",
5
5
  "main": "index.js",
6
6
  "scripts": {