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

Functions to copy/move files #107

Open
jyecusch opened this issue Mar 4, 2022 · 0 comments
Open

Functions to copy/move files #107

jyecusch opened this issue Mar 4, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jyecusch
Copy link
Member

jyecusch commented Mar 4, 2022

Probably not urgent, but features that simplify and optimize moving/copying files would be useful. Particularly if we can use steams or existing features of the storage service to make the moves use less memory on functions.

import { bucket } from "@nitric/sdk";

const pics = bucket('pics').for('reading', 'writing');
const archive = bucket('archive').for('reading', 'writing');

// One option - short, but maybe limiting since you couldn't copy between buckets - probably not good.
await pics.copy('source/pic.jpg', 'dest/pic-new.jpg');

// Other options - allow copying between buckets, but more code.
await archive.file('src/pic-new.jpg').copyTo(pics.file('dest/pic.jpg'));

await archive.copy('dest/pic.jpg', pics.file('source/pic.jpg'));

await archive.copy(archive.file('dest/pic-new.jpg'), pics.file('source/pic.jpg'));

await archive.file('dest/pic-new.jpg').copyFrom(pics.file('source/pic.jpg'));

await pics.file('source/pic.jpg').copyTo(archive.file('dest/pic-new.jpg'))
@jyecusch jyecusch added the enhancement New feature or request label Mar 4, 2022
@raksiv raksiv added the good first issue Good for newcomers label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants