Field | Type | Description |
contentType | string | Content type, defaults to "application/octet-stream". |
data | string or ArrayBuffer. | File content, usually using the return value of open(). |
name | string | File name, defaults to timestamp in nanoseconds. |
import http from 'pts/http';const data = open('./sample/tmp.js');export default function () {const file = http.file(data, 'data', 'application/json');console.log(file.data.length); // 231console.log(file.name); // dataconsole.log(file.contentType); // application/json}
Feedback