2.0.0 • Published 2 years ago
@uploadjoy/api-client v2.0.0
@uploadjoy/client
This is a package for Uploadjoy's TypeScript API client.
You can use this client to make API calls to Uploadjoy's API.
Installation
npm install --save @uploadjoy/client
Usage
Initializing the client
import { Uploadjoy } from "@uploadjoy/client";
export const ujClient = new Uploadjoy({
apiToken: "abcdefg",
});
Making API calls with the client
Example 1: Get an S3 presigned url to download an already uploaded object.
const keys = ["my-private-file.jpg"];
const response = await ujClient.presignedUrl.downloadPrivateObjects(
{
keys,
presignedUrlOptions: { expiresIn: 3600 },
}
);
console.log(response.data);
/** Prints:
{
presignedUrls: {
key: string;
url?: string | undefined;
error?: string | undefined;
}[];
};
* /
Example 2: Abort a multipart upload.
const uploadId: 'abc123';
const key: 'a/b/c/file-to-abort.txt';
const response = await uj.multipartUpload.abort({
uploadId,
key,
});
console.log(response.data);
/** Prints:
{
uploadId: string;
key: string;
}
* /
2.0.1-canary.b48bdb6
2 years ago
2.0.1-canary.562e880
2 years ago
2.0.1-canary.a215ab7
2 years ago
2.0.1-canary.3e86b22
2 years ago
2.0.1-canary.1b01ce4
2 years ago
2.0.1-canary.56db732
2 years ago
2.0.1-canary.15521d8
2 years ago
2.0.1-canary.cef900e
2 years ago
2.0.1-canary.496c740
2 years ago
1.0.1-canary.0915f74
2 years ago
2.0.0
2 years ago
1.0.1-canary.da04f50
2 years ago
1.0.0
2 years ago
0.5.1-canary.6684995
2 years ago
0.5.1-canary.9fe0f0f
2 years ago