StorageApi

getFilePath

For GCP cloud storage bucket Get the file path based on the file ID.

StorageApi.getFilePath(fileId)

Parameters

fileId: string

Returns

The file path for the input File ID.

getFileIdByPath

For GCP cloud storage bucket Get the file ID based on the absolute file path.

StorageApi.getFileIdByPath(absoluteFilePath)

Parameters

absoluteFilePath: string

Returns

The File ID using file path.

getFolderPath

For GCP cloud storage bucket Get the folder path based on the folder ID.

StorageApi.getFolderPath(folderId)

Parameters

folderId: string

Returns

Folder path.

getSignedUrl

For GCP cloud storage bucket Get a signed URL for accessing a file.

StorageApi.getSignedUrl(filePath)
or
StorageApi.getSignedUrl(filePath, duration, unit)
or
StorageApi.getSignedUrl(bucketName, filePath)
or
StorageApi.getSignedUrl(bucketName, filePath, duration, unit)

Parameters

filePath: string
duration: int
unit: string
bucketName: string

Returns

Signed URL for accessing the file.

copyFileToBucket

For GCP cloud storage bucket Copy a file to the specified bucket.

StorageApi.copyFileToBucket(sourceFilePath, targetFilePath)
or
StorageApi.copyFileToBucket(bucketName, sourceFilePath, targetFilePath)
or
StorageApi.copyFileToBucket(bucketName, serviceAccountPropName,
      sourceFilePath, targetFilePath)

Parameters

sourceFilePath: string
targetFilePath: string
bucketName: string
serviceAccountPropName: string

Returns

Response from the server.

copyFileFromBucket

For GCP cloud storage bucket Copy a file from the specified bucket.

StorageApi.copyFileFromBucket(sourceFilePath, targetFilePath)
or
Storageapi.copyFileFromBucket(bucketName, sourceFilePath, targetFilePath)
or
Storageapi.copyFileFromBucket(bucketName, serviceAccountPropName,
      sourceFilePath, targetFilePath)

Parameters

sourceFilePath: string
targetFilePath: string
bucketName: string
serviceAccountPropName: string

Returns

Response from the server.

copyFileWithinBucket

For GCP cloud storage bucket Copy a file within the same bucket.

StorageApi.copyFileWithinBucket(sourceFilePath, targetFilePath)
or
StorageApi.copyFileWithinBucket(sourceFilePath, targetFilePath, makeCopy)
or
StorageApi.copyFileWithinBucket(bucketName, sourceFilePath, targetFilePath)
or
StorageApi.copyFileWithinBucket(bucketName, sourceFilePath, targetFilePath, makeCopy)

Parameters

sourceFilePath: string
targetFilePath: string
makeCopy: bool
bucketName: string

Returns

Response from the server.

writeToBucket

For GCP cloud storage bucket Write data to a file in the specified bucket.

StorageApi.writeToBucket(bytes, targetFilePath, contentType)
or
StorageApi.writeToBucket(bucketName, bytes, targetFilePath, contentType)

Parameters

bytes: bytes[]
targetFilePath: string
contentType: string
bucketName: string

Returns

Response from the server.

readFromBucket

For GCP cloud storage bucket Read the content of a file from the specified bucket.

StorageApi.readFromBucket(sourceFilePath)
or
StorageApi.readFromBucket(bucketName, sourceFilePath)

Parameters

sourceFilePath: string
bucketName: string

Returns

Content of the file.

listFiles

For GCP cloud storage bucket List files in the specified path.

StorageApi.listFiles(pathName, versioned)
or
StorageApi.listFiles(bucketName, pathName, versioned)
or
StorageApi.listFiles(bucketName, pathName,
      versioned, pageToken, pageSize)

Parameters

pathName: string
versioned: bool
bucketName: string
pageToken: string
pageSize: int

Returns

List of dictionaries containing file details.

saveFileObject

For GCP cloud storage bucket Save a file object.

StorageApi.saveFileObject(fileObject)

Parameters

fileObject: dictionary

Returns

Response from the server.

exists

Check if file exists.

StorageApi.exists(filePath)

Parameters

filePath: string

Returns

True if the file exists, False otherwise.

getFileList

Get list of files in folder

StorageApi.getFileList(folderId, orderBy)

Parameters

folderId: int
orderBy: string

Returns

List

getFilesPages

Get files pages

StorageApi.getFilesPage(bucketName, pathName,
      versioned)
or 
StorageApi.getFilesPage(bucketName, pathName,
                      versioned, pageToken, pageSize)

Parameters

bucketName: string
pathName: string
versioned; bool
pageToken: string
pageSize: int

Returns

FilesPage

getBucketName

Get default bucket name.

StorageApi.getBucketName()

Parameters

None

Returns

Bucket name.

shareWithTenants

For GCP cloud storage bucket Share a file with tenants.

StorageApi.shareWithTenants(params)

Parameters

params: dictionary

Returns

Response from the server.

copyLargeFileToBucket

For GCP cloud storage bucket Copy a large file to the specified bucket

StorageApi.copyLargeFileToBucket(sourceFilePath, targetFilePath)
or
StorageApi.copyLargeFileToBucket(bucketName, sourceFilePath,
      targetFilePath)
or
StorageApi.copyLargeFileToBucket((bucketName, serviceAccountPropName,
      sourceFilePath, targetFilePath)

Parameters

sourceFilePath: string
targetFilePath: string
bucketName: string
serviceAccountPropName: string

Returns

Response from the server.

makePublic

make a file public

StorageApi.makePublic(bucketName, filePath)
or 
StorageApi.makePublic(bucketName, serviceAccountPropName,
      filePath)

Parameters

bucketName: string
filePath: string
serviceAccountPropName: string

Returns

Response from the server.

getContent

Get content of a doc

StorageApi.getContent(doc)

Parameters

doc: dictionary

Returns

Object

getBucketPath

Get bucket path using file object

StorageApi.getBucketPath(fileObject)

Parameters

fileObject: dictionary

Returns

String

getBucketPath

Get path using fileId

StorageApi.getBucketPath(fileId)

Parameters

fileId: string

Returns

String

Last updated