gcs_file()

Read(582) Label: storage bucket,

Description:

Get the specified object in a storage bucket.

Syntax:

gcs_file(fd,bucket,key[:cs])

Note:

External library function (See External Library Guide).

The function supports calculating file-related functions, including f.exists(), f.name(), f.size(), f.date(), f.read(), f.import() and f.export(), on the returned file object.

Parameter:

fd

GCS connection object

bucket

Storage bucket

key

File name in the storage bucket

cs

Encoding name; use this encoding to save or open a file

Return value:

File object

Example:

 

A

 

1

=file("F:/gcs.json").read()

 

2

=gcs_open(A1)

Connect to GCS service.

3

=gcs_file(A2, "test1","emp.txt")

Load emp.txt in the storage bucket test1.

4

=A3.name()

Get the full path containing the file name.

5

=A3.import@t()

Return the file data as a table sequence.

6

=A3.cursor@t().fetch(10)

Read data in the form of cursor.

7

>gcs_close(A2)

Close the GCS connection.