baraich-cloud
v0.1.0
Published
A Node SDK for baraich-cloud
Downloads
33
Readme
Baraich Cloud
A NodeJS SDK for developers, that want an easy solution to uploading files.
Usage
// baraichCloud.ts
import { BaraichCloud } from "baraich-cloud";
export const baraichCloud = new BaraichCloud({
apiVersion: "v1",
});
// Uploader.tsx
import { baraichCloud } from "./baraichCloud.ts";
export default function Uploader() {
// ....
const handleUpload = function (file: File | Blob) {
baraichCloud.uploadFile(file, {
progress: (percentage) => {},
onError: () => {},
onSuccess: () => {},
});
};
// ....
}
// Previewing the file
import { baraichCloud } from "./baraichCloud.ts";
import { DocumentRenderer, DocumentViewer } from "fck-old-file-viewers";
export default function Preview() {
return (
<DocumentViewer
docRenderer={DocumentRenderer}
fileExt={"png"}
fileName={"1726814355ABC.png"}
fileUrl={baraichCloud.getFileUrl("1726814355ABC")} // The FileKey
/>
);
}