Skip to main content

sdk.file_2.filetodrive

Home > @matterway/sdk > File_2 > fileToDrive

File_2.fileToDrive() function

Writes a file to the local drive.

Signature:

export declare function fileToDrive(file: SdkFile, path: string): Promise<void>;

Parameters

ParameterTypeDescription
fileSdkFileThe SdkFile object containing the data to write.
pathstringThe path of the file to write.

Returns:

Promise<void>

Promise of void

Example

const file = { name: 'example.txt', data: 'SGVsbG8gV29ybGQh', type: 'text/plain' }; const path = 'documents/'; await fileToDrive(file, path);