All Products
Search
Document Center

Drive and Photo Service:Getting started

Last Updated:Dec 22, 2025

aliyun-pds-js-sdk is an SDK for JavaScript provided by Photo and Drive Service (PDS). This SDK allows you to perform basic operations on PDS resources. Developers can use this SDK to easliy develop PDS applications. In addition to basic file operations such as upload, download, copy, move, and delete, this SDK allows you to perform basic operations on resources such as drives, shared directories, and groups. The SDK can be used in both browsers and Node.js platforms, such as Electron and Node.

GitHub repository: https://github.com/aliyun/aliyun-pds-js-sdk.

Important
Note: Drive and Photo Service SDK for JavaScript V1.0.0 and later do not support features in hosting mode.
Note

The version of Node.js dependencies must be 16.15.0 or later.

Drive and Photo Service resources

  1. The following structure shows the resources in a domain:

Domain/
  |-- Group                # The groups or teams.
  |-- User                 # The users.
  |-- Account              # The accounts.
  |-- Drive                # The drives.
  |-- ShareLink            # The sharing links. 
  |-- File                 # The file-related resources, including the new share permissions and recycle bin.
  1. A user can be associated with multiple accounts. An account is used by a user for logon, such as DingTalk logon.

  2. A group or user can be nested in another group. A user can be added to a group as a member.

Group/
  |-- Group
  |-- User
  1. The owner of a drive can be a group or user.

  2. A file must belong to a drive.

Drive/          # The drive.
  |-- File

Installation

Run the following command to install aliyun-pds-js-sdk:

npm i -S aliyun-pds-js-sdk

Note: Make sure that Node.js 16.15.0 or later is installed.

Import

1. Use the SDK in a Vue or React project

import {PDSClient} from 'aliyun-pds-js-sdk/browser' 

2. Use the SDK in the Node.js environment

const {PDSClient} = require('aliyun-pds-js-sdk')

3. Import the SDK by using the script tag in a browser

After you install the SDK by using npm, you can copy the aliyun-pds-js-sdk.umd.cjs file in the node_modules/aliyun-pds-js-sdk/dist/browser/ directory to your static server or the Alibaba Cloud CDN (CDN) service, and import the SDK by using the script tag.

<script src="/path/to/dist/browser/aliyun-pds-js-sdk.umd.cjs"></script>
const { PDSClient } = window.PDS_SDK

Sample code

The features of Drive and Photo Service API are implemented by using the methods of the PDSClient class. To use the features, you need to create a PDSClient instance. Then, you can use the methods of the instance to call the API operations of Drive and Photo Service.

const domain_id = "The ID of the domain" // Example: bj123.
const config = {
   token_info: {...},
   api_endpoint: `https://${domain_id}.api.aliyunpds.com`,
}

const pds = new PDSClient(config)

let { items=[], next_marker } = await pds.listDrives({ limit:10 })
  • For more information about how to construct the config parameter, see PDSClient.