uri_file_reader 1.0.1 copy "uri_file_reader: ^1.0.1" to clipboard
uri_file_reader: ^1.0.1 copied to clipboard

PlatformAndroid

Support directly obtaining file content (bytes) via URI without copying to a private directory

uri_file_reader #

支持 Flutter应用 从 URI 读取文件和获取一些文件的基础信息,避免复制一份到应用私有目录导致的缓存增长,特别是一些大文件


简体中文 | English


平台支持 #

平台 支持
Android ✔️
IOS ✖️

快速开始 #

用法 #

import 'package:uri_file_reader/uri_file_reader.dart';

final uri = "content://...";

//从URI中获取文件基础信息
final fileInfo = await uriFileReader.getFileInfoFromUri(uri);
final fileName = fileInfo?.fileName;
final filePath = fileInfo?.path;
final size = fileInfo?.size;

// 以流读取文件字节
final stream = uriFileReader.readFileAsBytesStream(uri);
if (stream == null) {
  print("read file failed!");
}else{
    stream.listen((bytes){
    });
}

//从uri复制文件到另一个路径
//新的文件夹路径不能以 '/' 或 '\'结尾
final newPath = uriFileReader.copyFileFromUri(uri, newFolderPath)

1
likes
145
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

Support directly obtaining file content (bytes) via URI without copying to a private directory

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on uri_file_reader

Packages that implement uri_file_reader