Skip to content

Commit

Permalink
[add] AbortSignal.any() polyfill
Browse files Browse the repository at this point in the history
[optimize] expose Request options on Client methods
[optimize] update Upstream packages
  • Loading branch information
TechQuery committed May 18, 2024
1 parent 6fd6a3d commit ba08293
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 76 deletions.
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ const bufferClient = new HTTPClient({ responseType: 'arraybuffer' });

document.querySelector('#download').onclick = async () => {
const fileURL = 'https://your.server/with/Range/header/supported/file.zip';
const suggestedName = fileURL.split('/').at(-1);
const suggestedName = new URL(fileURL).pathname.split('/').pop();

const fileHandle = await showSaveFilePicker({ suggestedName });
const writer = await fileHandle.createWritable(),
stream = bufferClient.download(fileURL);

try {
for await (const { total, loaded, percent, buffer } of stream) {
writer.write(buffer);
await writer.write(buffer);

console.table({ total, loaded, percent });
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koajax",
"version": "1.1.0-rc.1",
"version": "1.1.0",
"license": "LGPL-3.0",
"author": "shiy2008@gmail.com",
"description": "HTTP Client based on Koa-like middlewares",
Expand Down Expand Up @@ -39,8 +39,8 @@
"@types/core-js": "^2.5.8",
"@types/jest": "^29.5.12",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.19.32",
"core-js": "^3.37.0",
"@types/node": "^18.19.33",
"core-js": "^3.37.1",
"cross-env": "^7.0.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
Expand All @@ -52,7 +52,7 @@
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"typedoc": "^0.25.13",
"typedoc-plugin-mdn-links": "^3.1.24",
"typedoc-plugin-mdn-links": "^3.1.25",
"typescript": "~5.4.5"
},
"prettier": {
Expand Down
Loading

0 comments on commit ba08293

Please sign in to comment.