如何使用React Native将以ph://开头的文件作为base64字符串读取?

问题描述 投票:1回答:1

[我正在尝试读取以ph://开头的图像文件,并使用RNFS将它们转换为base64字符串,但是很不幸,我收到了ENOENT: no such file or directory错误。

如何读取这些文件并将其转换为base64?

react-native react-native-ios react-native-fs
1个回答
0
投票

您可以使用react-native-convert-ph-asset

import RNConvertPhAsset from 'react-native-convert-ph-asset';

const convertLocalIdentifierToAssetLibrary = async (localIdentifier) => {
  return await RNHeicConverter.convert({
    // options
    path: localIdentifier,
  });
};
© www.soinside.com 2019 - 2024. All rights reserved.