tencent cloud

Last updated: 2025-03-10 17:04:49
File
Last updated: 2025-03-10 17:04:49
File represents the file object used for upload in FormData, which is generated by http.file.

Field

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.

Samples

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); // 231
console.log(file.name); // data
console.log(file.contentType); // application/json
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback