as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
The Vega File System API provides support for enabling file system querying, traversing, reading, and writing operations.

Remarks

Apps operate in a sandboxed environment with a restricted view of the device file system. Vega makes the following app-specific directories available in the sandbox.

Get started

Setup

  1. Add the following library dependency to the dependencies section of your package.json file.
  1. Regenerate the package-lock.json file using the npm install command.

Usage

The following examples use async/await to handle Promises returned by FileSystem methods. This pattern provides a cleaner way to work with asynchronous operations.

Open a file

This example uses async/await to handle the Promise returned by FileSystem.openFile().

Remove a file

This example uses async/await to handle the Promise returned by FileSystem.removeFile().

Remove a directory

This example uses async/await to handle the Promise returned by FileSystem.removeDir().

Remove a directory recursively

This example uses async/await to handle the Promise returned by FileSystem.removeDirAll().

Read a file as a string

This example uses async/await to handle the Promise returned by FileSystem.readFileAsString().

Write a string to a file

This example uses async/await to handle the Promise returned by FileSystem.writeStringToFile().

Access file metadata

This example uses async/await to handle the Promise returned by FileSystem.getMetadata().

Access directory entries

This example uses async/await to handle the Promise returned by FileSystem.getEntries().

API Reference

Interfaces


最后修改于 2026年7月22日