- Documentation
Torch Object Storage
SDK Reference
Browser.js
Installing the Browser.js SDK
Browser.js
Installing the Browser.js SDK
Installing the Browser.js SDK
This article outlines the preparatory steps and installation procedures for the Browser.js SDK.
Preparatory Work
- When accessing TOS directly via a browser, the CORS configuration rules are required as follows:
SDK Download Link
Supported Browsers
The following browsers are supported by the TOS Browser.js SDK:
- Internet Explorer version 10 and above
- Mainstream versions of Chrome, Firefox, and Safari
- Default browsers of mainstream versions of the Android, iOS, and Windows Phone operating systems
Notes
Due to the specific constraints of the browser environment, the TOS Browser.js SDK cannot utilize the following features:
- Operating Local Files: Browsers cannot directly access the local file system. It is recommended to use pre-signed URLs to download files.
- Since TOS temporarily does not support cross-origin requests related to Buckets, it is recommended that you perform Bucket-related operations in the TOS Console.
Install the SDK
Browser Introduction
warning
- As some browsers do not support Promise, you need to include a Promise compatibility library during installation. For example, IE10 and IE11 require the inclusion of promise-polyfill.
- The method of incorporating online resources relies on the stability of CDN servers. Therefore, it is recommended to adopt offline integration, either by utilizing local resources or by building the resources independently.
- Introduction of Online Resources
- Incorporating local resources
Utilize the TOS object in the code.
Installing the SDK via npm or yarn
After successful installation, you can use import or require to import. You can use the following commands to import the SDK. Note that there are differences between importing modules using ES6 import statements and CommonJS (CJS) import commands.
warning
When using import or require, you need to use relevant bundling tools in the development environment, such as webpack, browserify, etc.
- Use import to perform an import
Use the TOS object in the code.
Last updated: 2025.09.22 18:55:46