- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
与关于此主题的另一篇文章类似,我一直在尝试使用本地 XML 文件的文件路径从命令行运行我的应用程序,以便我的 main.dart
可以解析这个文件,以便从中提取与程序操作相关的信息。我一直不知道如何正确访问 FileEntry
launchData
中包含的引用资料-- onLaunched
的参数事件。
这是我目前拥有的:
manifest.json :
...
"permissions": [
"storage",
"fileSystem",
"*://*/*"
],
"file_handlers" : {
"any" : {
"types" : [ "*" ]
}
},
...
chrome.app.runtime.onLaunched.addListener(function(launchData) {
chrome.app.window.create(
'htmlFile.html',
{...},
function(createdWindow) {
createdWindow.contentWindow.launchData = launchData;
});
});
launchData
来自
main.dart
因为试图做
FileEntry entry = (chrome.app.window.current().contentWindow.launchData as chrome.LaunchData).items.elementAt(0).entry;
FileEntry
导致访问
launchData
时出错.我真的很困惑我应该如何访问
FileEntry
结果,我想从我的 Dart 代码中得到。
最佳答案
我最终将此作为我的解决方案:
manifest.json :
...
"file_handlers": {
"any": {
"extensions": [
"xml"
]
}
},
...
chrome.app.runtime.onLaunched.addListener(function(launchData) {
chrome.app.window.create(
'htmlSource.html',
{
id: 'mainWindow',
state: "fullscreen"
},
function(createdWindow) {
if(launchData.items !== undefined) {
launchData.items[0].entry.file(
function(result) {
var reader = new FileReader();
var XML;
reader.onloadend = function(){
XML = reader.result;
chrome.storage.local.set({'XML': XML});
};
reader.readAsText(result);
},
function(){
console.log("Error reading XML file");
}
);
} else {
console.log("No file was detected.");
}
});
});
String text = (await chrome.storage.local.get('XML'))['XML'];
关于file - Chrome 打包应用程序 : Retrieving FileEntry in Dart from command line (LaunchData) parameter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31975094/
对于我的 Web 应用程序,我想使用 ace:fileEntry 组件。 我尝试了展示,但不起作用。没有错误。 fileEntryListener 永远不会被调用。文件仍在上传(浏览器显示),但文件未
我正在尝试使用 ace:fileEntry 组件将图像上传到我的数据库,但现在,我想更改“Seleccionar archivo”中“浏览”按钮的名称,但我不知道该名称在哪里已存储。
是否可以通过拖放打开文件在 Chrome 应用程序中获取 fileEntry 对象?当我将文件放入我的应用程序时,我只得到一个似乎与文件系统无关的 file 对象。更改后我无法使用该对象保存文件。 我
我正在尝试从 iOS 文件系统获取文件。我的文件位于: console.log(PATH); --> file:///var/mobile/Applications/B816F30B-791A-43E
到目前为止,我知道我可以通过 chrome.fileSystem.chooseEntry 获取用于读/写的 fileEntry,但这会弹出一个 fileManager 让用户选择文件/目录。 我想要的
我目前正在加载丢失的文件: var files = e.dataTransfer.items; for (var i = 0; i ,然后我们可以从中创建一个 objectURL: var reade
我正在尝试实现上传文件和文件夹的功能。我在 Chrome 中放置一些文件和文件夹,然后获得 dataTransferItemList 类型的条目列表,然后我想对列表中的每个条目执行一些操作。我使用 w
我正在使用 HTML5 FileSystem API在 Chrome Packaged App写入日志文件。我希望用户能够下载此文件,因此我尝试了以下内容: fs.root.getFile('log.
我正在使用 Phonegap 2.0 并尝试从其 URI 中获取编码为 base64 的媒体,但没有成功。 function tryToSend(fileReader) { // I don'
我正在使用 FormData使用 AJAX 上传文件(用于进度条,尽管为简单起见我省略了该代码): $(document).ready(function() { $(document).
有谁知道为什么在我的 Windows 8 应用程序中使用“fileEntry.file”总是失败? 如果我使用以下代码,则会失败: Windows.Storage.StorageFile.getFil
是否可以将 FileEntry 转换为标准的 JavaScript 对象 File?我在文档中找不到任何有意义的内容 https://developer.chrome.com/apps/fileSys
在 Chrome 扩展程序中,我使用 HTML5 FileSytem API。 我正在检索文件夹中的记录列表。 var entries = []; var metadata = []; listFil
我正在测试一些新的 JS 文件系统功能,即在本地文件系统中创建一个空文本文件。我正在从本地路径 (file:///) 运行 HTML 和 JS 文件。为此,我使用 CLI 中的 --allow-fil
与关于此主题的另一篇文章类似,我一直在尝试使用本地 XML 文件的文件路径从命令行运行我的应用程序,以便我的 main.dart可以解析这个文件,以便从中提取与程序操作相关的信息。我一直不知道如何正确
我想从 Android 上的 SD 卡中提取一系列文件。我的问题是如何获取 sdcard 中某些内容的 FileEntry 对象? public void pull(FileEntry[] entr
我正在为 Liferay 编写 Portlet,并且需要 ace:fileEntry 组件。我已经有一些我终于能够解决的问题。但现在我面临一个我无法理解的问题。 当包含 ace:fileEntry 的
我是一名优秀的程序员,十分优秀!