MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / serialize_file

Function serialize_file

webiojs/src/utils.ts:154–163  ·  view source on GitHub ↗
(file: File, input_name: string)

Source from the content-addressed store, hash-verified

152
153// make File object to Blob
154export function serialize_file(file: File, input_name: string) {
155 let header = {
156 'filename': file.name,
157 'size': file.size,
158 'mime_type': file.type,
159 'last_modified': file.lastModified / 1000,
160 'input_name': input_name
161 }
162 return new Blob([serialize_json(header), int2bytes(file.size), file], {type: 'application/octet-stream'});
163}
164
165// make json object to Blob
166export function serialize_json(json_obj: any) {

Callers 2

create_elementMethod · 0.90
submitMethod · 0.90

Calls 2

serialize_jsonFunction · 0.85
int2bytesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…