cordis-axios
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -38,3 +38,3 @@ /// <reference types="node" /> | ||
resolve(url: string): string; | ||
file(url: string): Promise<Quester.File>; | ||
file(url: string, options?: Quester.FileOptions): Promise<Quester.File>; | ||
} | ||
@@ -54,2 +54,5 @@ export declare namespace Quester { | ||
} | ||
interface FileOptions { | ||
timeout?: number | string; | ||
} | ||
const isAxiosError: <T = any, D = any>(payload: any) => payload is types.AxiosError<T, D>; | ||
@@ -56,0 +59,0 @@ interface Config { |
@@ -97,3 +97,3 @@ var __create = Object.create; | ||
} | ||
async file(url) { | ||
async file(url, options = {}) { | ||
var _a, _b, _c, _d; | ||
@@ -108,3 +108,7 @@ const capture = /^data:([\w/-]+);base64,(.*)$/.exec(url); | ||
let [, name] = this.resolve(url).match(/.+\/([^/?]*)(?=\?)?/); | ||
const { headers, data } = await this.axios(url, { method: "GET", responseType: "arraybuffer" }); | ||
const { headers, data } = await this.axios(url, { | ||
method: "GET", | ||
responseType: "arraybuffer", | ||
timeout: +options.timeout || void 0 | ||
}); | ||
const mime = headers["content-type"]; | ||
@@ -111,0 +115,0 @@ if (!name.includes(".")) { |
{ | ||
"name": "cordis-axios", | ||
"description": "Axios service for cordis", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"main": "lib/index.js", | ||
@@ -48,5 +48,5 @@ "typings": "lib/index.d.ts", | ||
"axios": "~1.1.3", | ||
"cosmokit": "^1.4.1", | ||
"cosmokit": "^1.4.2", | ||
"mime-db": "^1.52.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54574
643
Updatedcosmokit@^1.4.2