## ty.env

Environment Variables

### Properties

#### USER_DATA_PATH `string`

The user directory path in the file system (local path). Use this path when operating on files.

```js
// Write a file
const fileManager = await ty.getFileSystemManager();
const fileRoot = ty.env.USER_DATA_PATH;
const filePath = `${fileRoot}/test.json`;
await fileManager.writeFile({
  filePath: filePath,
  data: `{"test": "test"}`,
});

// Share the file
ty.share({
  title: 'Share a file',
  message: 'This is a JSON file, calling the system share',
  type: 'More',
  filePath: filePath,
  contentType: 'file',
  success() {
    console.log('Share succeeded');
  },
  fail(err) {
    console.log('Share failed', err);
  },
});
```

> For other file operation methods, please refer to [FileSystemManager](/en/miniapp/develop/miniapp/api/file/getFileSystemManager).
