Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyObject is returning /tmp/buckets//<bucket_name>/key #68

Open
jcald1 opened this issue Apr 24, 2020 · 0 comments
Open

copyObject is returning /tmp/buckets//<bucket_name>/key #68

jcald1 opened this issue Apr 24, 2020 · 0 comments

Comments

@jcald1
Copy link

jcald1 commented Apr 24, 2020

I'm running v 4.0.1

copyObject is returning /tmp/buckets//<bucket_name>/key

Code:
const copyObject = s3 => sourceBucket => outputBucket => ( oldKey, newKey) => {

  const CopySource = `/${sourceBucket}/${oldKey}`;
  const params = {
    Bucket : outputBucket,
    CopySource,
    Key    : newKey
  };
  return s3.copyObject(params).promise();

test file:

const AWSMock = require('mock-aws-s3');

AWSMock.config.basePath = '/tmp/buckets';

const FAKE_S3 = AWSMock.S3({
params : {
Bucket : KNOWN_OUTPUT_BUCKET
}
}),
FAKE_OLD_KEY = 'oldkey',
FAKE_NEW_KEY = 'newkey',
FAKE_BODY = '123';

copyObject(FAKE_S3)(KNOWN_OUTPUT_BUCKET)(KNOWN_OUTPUT_BUCKET)(FAKE_OLD_KEY, FAKE_NEW_KEY)
.then(res => {
console.log('res',res)


Output:

res {
Bucket: '/tmp/buckets/media-output-dev-use1-v1',
CopySource: '/tmp/buckets//media-output-dev-use1-v1/oldkey',
Key: 'newkey'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant