将文本文件与应用程序捆绑在一起的正确方法是什么 [英] What is the proper way to bundle a textfile with the app

查看:47
本文介绍了将文本文件与应用程序捆绑在一起的正确方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用expo,我需要向应用程序提供一个文本文件,其中包含数据(单词词典).我该如何提供它以及如何将其读入内存?

Using expo, I need to provide a text-file with data (a word-dictionary) to the app. How do I provide that and how do I read it into memory?

推荐答案

我将文本文件转换为json格式的内容.这很容易使用.json是自动解析的.

I translated my textfile to a json-formatted content. This can very easy be used. The json is parsed automatically.

import data from './assets/woerter.json';

这篇关于将文本文件与应用程序捆绑在一起的正确方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆