Skip to content

Commit

Permalink
Adds Buffer support to assets uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredge committed Jan 31, 2024
1 parent 713f59b commit ec0881e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
16 changes: 16 additions & 0 deletions packages/client-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/client-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.11.13",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3"
Expand All @@ -35,6 +36,5 @@
"esm"
],
"dts": true
},
"dependencies": {}
}
}
14 changes: 8 additions & 6 deletions packages/client-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ export interface PathString {
path: string;
content: string;
}
// export interface PathBuffer{
// path: string;
// content: Buffer;
// }
export interface PathBuffer{
path: string;
content: Buffer;
}

export interface ExternalLink {
href: string;
Expand All @@ -20,8 +20,7 @@ export interface DocumentInput {
keywords?: string[];
date?: string;
};
assets?: PathString[];
//| PathBuffer
assets?: PathString[] | PathBuffer[];
//| ExternalLink
}

Expand Down Expand Up @@ -143,8 +142,11 @@ export class Onedoc {
});

if (asset?.content) {

await uploadToSignedUrl(e.signedUrl, e.path, e.token, asset.content);

} else if (e.path == "/index.html") {

let htmlBuilder = new HtmlBuilder("Onedoc");

const styleSheets = document.assets
Expand Down

0 comments on commit ec0881e

Please sign in to comment.