Copy a file to a different location
Copies a network or shortcut to a target folder. Folder copying is not supported. The copied file will be placed in the specified target folder with the same name and properties as the original.
Copy operation configuration
UUID of the source file to copy
UUID of the target folder where the file will be copied
Type of file being copied (only NETWORK and SHORTCUT are supported)
OptionalaccessKey?: stringOptional access key for accessing protected files
Promise resolving to the copied file's UUID and modification time
// Copy a network to a specific folder
await client.files.copyFile({
fileId: "12345678-1234-1234-1234-123456789abc",
targetId: "87654321-4321-4321-4321-876543210fed",
type: "NETWORK"
});
// Copy a shortcut with access key
await client.files.copyFile({
fileId: "11111111-2222-3333-4444-555555555555",
targetId: "66666666-7777-8888-9999-000000000000",
type: "SHORTCUT",
accessKey: "secret-key-123"
});
Get file count statistics for the current user
Get files in the trash for the current user
Permanently delete all files in trash
Permanently delete a file from trash
File UUID to permanently delete
Restore files from trash
Array of network UUIDs to restore
Array of folder UUIDs to restore
Array of shortcut UUIDs to restore
Update member permissions for shared files
This method allows you to grant, modify, or revoke permissions for specific members across multiple files in a single operation. It's particularly useful for bulk permission management and ensuring consistent access control.
The sharing member request containing files and member permissions
Request object for sharing member operations
This interface defines the structure for requests that manage file sharing permissions. It combines file identification with member permission management in a single request.
Object mapping file UUIDs to their corresponding file types
Object mapping member UUIDs to their permission levels
Promise resolving to an object with file UUIDs as keys and permission status messages as values
// Grant permissions to multiple members for different files
const result = await client.files.updateMember({
files: {
"network-uuid-123": "NETWORK",
"folder-uuid-456": "FOLDER"
},
members: {
"user1-uuid": "READ",
"user2-uuid": "WRITE",
"user3-uuid": null // Revoke permissions
}
});
// Result example:
// {
// "network-uuid-123": "network permission granted",
// "folder-uuid-456": "folder permission granted"
// }
// Revoke all permissions for a user
await client.files.updateMember({
files: {
"network-uuid-789": "NETWORK"
},
members: {
"user-to-remove-uuid": null
}
});
List members and their permissions for specified files
Retrieves detailed permission information for the specified files, including the file type and a mapping of all users who have explicit permissions on each file. This is useful for auditing file access and understanding who has what level of access to your shared content.
Object mapping file UUIDs to their file types
Promise resolving to a list of permission records for each file
// Get permission details for multiple files
const permissions = await client.files.listMembers({
"12345678-1234-1234-1234-123456789abc": "NETWORK",
"87654321-4321-4321-4321-876543210fed": "FOLDER",
"11111111-2222-3333-4444-555555555555": "SHORTCUT"
});
// Result example:
// [
// {
// "12345678-1234-1234-1234-123456789abc": {
// type: "NETWORK",
// members: {
// "user1-uuid-1234-5678-9abc-def012345678": "READ",
// "user2-uuid-8765-4321-fedc-ba0987654321": "WRITE",
// "user3-uuid-1111-2222-3333-444444444444": "ADMIN"
// }
// }
// },
// {
// "87654321-4321-4321-4321-876543210fed": {
// type: "FOLDER",
// members: {
// "user4-uuid-aaaa-bbbb-cccc-dddddddddddd": "ADMIN",
// "user5-uuid-eeee-ffff-0000-111111111111": "READ"
// }
// }
// }
// ]
// Access specific file permissions
const networkPermissions = permissions.find(record =>
record["12345678-1234-1234-1234-123456789abc"]
)?.["12345678-1234-1234-1234-123456789abc"];
if (networkPermissions) {
console.log('File type:', networkPermissions.type); // "NETWORK"
console.log('Members:', networkPermissions.members);
// Check if specific user has permission
const userPermission = networkPermissions.members["user1-uuid-1234-5678-9abc-def012345678"];
console.log('User permission:', userPermission); // "READ"
}
Transfer ownership of networks to a new owner
This method transfers ownership of multiple networks to a specified user. The current owner will lose ownership rights, and the new owner will gain full control over the specified networks.
Transfer ownership request
Array of network UUIDs to transfer ownership for
UUID of the user who will become the new owner
Promise that resolves when the ownership transfer is complete
Optionallimit: numberShare files with public access
Makes specified files publicly accessible by generating access keys for each file. The generated access keys can be used by others to access the shared files without requiring explicit permissions.
Object mapping file UUIDs to their file types
Promise resolving to an object mapping file UUIDs to their generated access keys
// Share a network and a folder
const result = await client.files.share({
"e6fc6a72-59ea-4f1d-ad81-59eda2cb8dce": "NETWORK",
"40c08b7b-a4dd-4f00-87b3-1b945991948a": "FOLDER"
});
// Result example:
// {
// "e6fc6a72-59ea-4f1d-ad81-59eda2cb8dce": "abc123def456",
// "40c08b7b-a4dd-4f00-87b3-1b945991948a": "xyz789uvw012"
// }
// Use the access key to access shared content
const sharedNetwork = await client.networks.getNetwork(
"e6fc6a72-59ea-4f1d-ad81-59eda2cb8dce",
{ accessKey: result["e6fc6a72-59ea-4f1d-ad81-59eda2cb8dce"] }
);
Optionallimit: numberOptionalparentFolderId: stringOptionalaccessKey: stringUpdate folder properties
Updates the properties of an existing folder including name, description, and parent location. When parent is omitted, the folder remains in or is moved to the owner's home directory.
The UUID of the folder to update
Object containing folder properties to update
The new name for the folder
The new description for the folder
Optionalparent?: stringOptional UUID of the parent folder. If omitted, folder is placed in owner's home directory
Promise that resolves when the folder update is complete
// Update folder name and description, keep in current location
await client.files.updateFolder('folder-uuid', {
name: 'Updated Folder Name',
description: 'Updated folder description'
});
// Move folder to a different parent and update properties
await client.files.updateFolder('folder-uuid', {
name: 'Moved Folder',
description: 'This folder has been moved',
parent: 'parent-folder-uuid'
});
// Move folder to home directory by omitting parent
await client.files.updateFolder('folder-uuid', {
name: 'Home Folder',
description: 'Moved to home directory'
});
OptionalaccessKey: stringOptionalaccessKey: stringOptionalformat: stringOptionaltype: stringGet folder access key
Retrieves the access key for a folder if it has been enabled for public access. When a folder has an access key enabled, it can be accessed by others without explicit permissions using this key.
The UUID of the folder to get the access key for
Promise resolving to an object with accessKey property when enabled, or null when access key is not enabled on this folder
// Check if folder has an access key
const result = await client.files.getFolderAccessKey('12345678-1234-1234-1234-123456789abc');
if (result) {
console.log('Access key:', result.accessKey); // "sdfdfdfsdfdsfs"
// Use the access key to access the folder
const folderData = await client.files.getFolder(folderId, result.accessKey);
} else {
console.log('No access key enabled for this folder');
}
Optionallimit: numberCreate a shortcut to an existing NDEx object
Creates a shortcut (reference) to an existing network, folder, or shortcut. The shortcut can be placed in a specific folder or in the user's home directory.
Shortcut creation options
Display name for the shortcut
UUID of the target object to create a shortcut to
Type of the target object ('NETWORK', 'FOLDER', or 'SHORTCUT')
Optional UUID of the parent folder. If omitted, shortcut is created in user's home directory
Promise resolving to the created shortcut information
// Create shortcut to a network in home directory
await client.files.createShortcut({
name: "My Important Network Shortcut",
target: "12345678-1234-1234-1234-123456789abc",
targetType: "NETWORK"
});
// Create shortcut to a folder within another folder
await client.files.createShortcut({
name: "Research Folder Shortcut",
target: "87654321-4321-4321-4321-876543210fed",
targetType: "FOLDER",
parent: "11111111-2222-3333-4444-555555555555"
});
OptionalaccessKey: stringUpdate shortcut properties
Updates the properties of an existing shortcut including name, parent location, target, and target type. The parent attribute is always included in the request payload - when parent is omitted from the shortcut object, parent is set to null to indicate the shortcut should be moved to the owner's home directory.
The UUID of the shortcut to update
Object containing shortcut properties to update
The new name for the shortcut
UUID of the target object the shortcut points to
Type of the target object ('NETWORK', 'FOLDER', or 'SHORTCUT')
Optional UUID of the parent folder. If omitted, shortcut is moved to home directory
Promise resolving when the shortcut update is complete
// Update shortcut name and target, move to home directory
await client.files.updateShortcut('shortcut-uuid', {
name: 'Updated Shortcut Name',
target: 'target-network-uuid',
targetType: 'NETWORK'
});
// Update shortcut and move to a specific folder
await client.files.updateShortcut('shortcut-uuid', {
name: 'Folder Shortcut',
target: 'target-folder-uuid',
targetType: 'FOLDER',
parent: 'parent-folder-uuid'
});
// Update all shortcut properties
await client.files.updateShortcut('shortcut-uuid', {
name: 'Complete Update',
target: 'target-network-uuid',
targetType: 'NETWORK',
parent: 'parent-folder-uuid'
});
Set visibility for multiple files
Updates the visibility settings for the specified files, controlling who can access them based on the visibility level (public, private, etc.).
Visibility update configuration
Object mapping file UUIDs to their file types
The visibility level to apply to all specified files
Promise that resolves when the visibility has been updated
Search for files in NDEx
Searches files using the server's SimpleFileQuery request body and pagination
query parameters. The query object can filter by search text, owner, permission,
and file type, while visibility is sent separately as a required URL parameter.
Results are returned in a paginated object with numFound, start, and
a files array.
Search parameters
Parameters for searching files in NDEx
OptionalsearchString?: stringSearch terms as a string, supports Lucene syntax
OptionalaccountName?: stringUsername of the account to filter on, only files owned by that user will be returned
Optionalpermission?: PermissionFilter by permission level, only applicable to signed-in users
Optionaltype?: null | NDExFileTypeFile type to filter on, if null or omitted all file types will be returned
Visibility filter, only supports "PRIVATE" or "PUBLIC"
Optionalstart?: numberStarting index for pagination
Optionalsize?: numberNumber of results to return for pagination
Promise resolving to a paginated search result containing matching files
// Search for public networks containing "cancer"
const results = await client.files.searchFiles({
searchString: "cancer",
type: "NETWORK",
visibility: "PUBLIC",
start: 0,
size: 25
});
console.log(`Found ${results.numFound} total results`);
console.log(`Showing results starting at ${results.start}`);
results.files.forEach(file => {
console.log(`${file.name} (${file.type})`);
});
// Search for public networks owned by a specific user
const userNetworks = await client.files.searchFiles({
searchString: "name:pathway AND description:signaling",
accountName: "john_doe",
type: "NETWORK",
visibility: "PUBLIC"
});
// Search for private files the signed-in user can write to
const writableFiles = await client.files.searchFiles({
permission: "WRITE",
visibility: "PRIVATE",
start: 0,
size: 50
});
FilesService - NDEx file operations and task management Handles file uploads, downloads, exports, and asynchronous task tracking