1.2.1 • Published 5 years ago

uploadcare-rest v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Uploadcare Rest

npm version

This is a wrapper around the API made available by uploadcare. The library is written in TypeScript and has typings available.

The methods will be implemented gradually.

Currently implemented

Files

  • copy
  • remove
  • store

Example

const uploader = new Uploadcare(
    config.uploadcare.publicKey,
    config.uploadcare.privateKey,
);

// Copy a file to the CDN storage, for example a crop preview
const response = await uploader.files.copy(cdnUrlOrId);
const image = response.data;

// Check the type of the image. url for custom storage, file otherwise.
if (image.type === 'file') {
    // Type cast for TypeScript only
    const result = <UploadImageResult>image.result;
}

Upload

Example

const uploader = new Uploadcare(
    config.uploadcare.publicKey,
    config.uploadcare.privateKey,
);

const file = await uploader.upload.awaitFromUrl('https://picsum.photos/200/300/?random');
// That's all, the library takes care of checking the upload progress
// If you're not interested in waiting for the file, use the following
const idc = await uploader.upload.fromUrl('https://picsum.photos/200/300/?random');
1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago