1.0.13 • Published 5 years ago

react-native-omfs v1.0.13

Weekly downloads
2
License
ISC
Repository
-
Last release
5 years ago

react-native-omfs

方法列表:

  • createFile 创建文件
  • readFile 读文件
  • writeFile 写文件
  • appendFile 追加内容
  • unlink 删除文件
  • mkdir 创建目录,可多级
  • ls 查看目录
  • mv 移动文件
  • cp 拷贝文件
  • exists 文件是否存在
  • stat 文件信息
  • lstat 目录下文件信息
  • space 磁盘空间
  • imageType 获取image type

常量

  • DocumentDir Document目录
  • CacheDir Cache目录

示例

import {
    createFile,
    readFile,
    writeFile,
    appendFile,
    unlink,
    mkdir,
    ls,
    mv,
    cp,
    exists,
    stat,
    lstat,
    space,
    imageType,
    DocumentDir,
    CacheDir
} from 'react-native-omfs';

// 读写文件内容仅支持utf8文本
createFile('path/to/file', 'content,can be empty')
	.then(() => {
		// done
	});

readFile('path/to/file')
	.then((content) => {
		console.log(content);
	});

writeFile('path/to/file')
	.then(() => {
		// done
	});

appendFile('path/to/file')
	.then(() => {
		// done
	});

unlink('path/to/file')
	.then(() => {
		// done
	});
	
mkdir('path/to/dir')
	.then(() => {
		// done
	});

ls('path/to/dir')
	.then((items) => {
		console.log(items);
	});
	
mv('path/to/src', 'path/to/dest')
	.then(() => {
		// done
	});
	
cp('path/to/src', 'path/to/dest')
	.then(() => {
		// done
	});
	
exists('path/to/file')
	.then(info => {
		const exist = info.exists;
		const isDir = info.isDir;
	});
	
stat('path/to/file')
	.then((stat) => {
		console.log(stat);
	});
	
lstat('path/to/dir')
	.then((stats) => {
		console.log(stats);
	});
	
space()
	.then((space) => {
		console.log(space);
	});

imageType()
	.then((type) => {
		console.log(type);
	});	
	
	
1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago