![]() (iOS only) copyAssetsFileIOS(imageUri: string, destPath: string, width: number, height: number, scale?: number, compression?: number, resizeMode?: string): Promise Will overwrite destPath if it already exists. res/drawable is used as the source parent folder for image files, res/raw for everything else. copyFileRes(filename: string, destPath: string): PromiseĬopies the file named filename in the Android app's res folder and copies it to the given destPath path. copyFileAssets(filepath: string, destPath: string): PromiseĬopies the file at filepath in the Android app's assets folder and copies it to the given destPath path. On iOS an error will be thrown if the file already exists. Note: On Android copyFile will overwrite destPath if it already exists. copyFile(filepath: string, destPath: string): PromiseĬopies the file located at filepath to destPath. This is more performant than reading and then re-writing the file data because the move is done natively and the data doesn't have to be copied or cross the bridge. Moves the file located at filepath to destPath. moveFile(filepath: string, destPath: string): Promise encoding can be one of utf8 (default), ascii, base64. When position is undefined or -1 the contents is appended to the end of the file. Write the contents to filepath at the given random access position. write(filepath: string, contents: string, position?: number, encoding?: string): Promise appendFile(filepath: string, contents: string, encoding?: string): PromiseĪppend the contents to filepath. options optionally takes an object specifying the file's properties, like mode etc. writeFile(filepath: string, contents: string, encoding?: string): Promise The file type will be detected from the extension and automatically located within res/drawable (for image files) or res/raw (for everything else). ![]() Only the file name (not folder) needs to be specified. Reads the file named filename in the Android app's res folder and return contents. readFileRes(filename:string, encoding?: string): Promise Use base64 for reading binary files.įilepath is the relative path to the file from the root of the assets folder. Reads the file at path in the Android app's assets folder and return contents. readFileAssets(filepath:string, encoding?: string): Promise Note: reading big files piece by piece using this method may be useful in terms of performance. Reads length bytes from the given position of the file at path and returns contents. Note: you will take quite a performance hit if you are reading big files read(filepath: string, length = 0, position = 0, encodingOrOptions?: any): Promise Reads the file at path and return contents. require the module var RNFS = require ( 'react-native-fs' ) var uploadUrl = '' // For testing purposes, go to and create your own link // create an array of objects of the files you want to upload var files = [ readFile(filepath: string, encoding?: string): Promise
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |