Skip to content

Functions to copy/move files #107

@jyecusch

Description

@jyecusch

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'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions