s3_file()

Read(1541) Label: s3, file,

Description:

Get the specified object from a bucket.

Syntax:

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

Note:

External library function (See External Library Guide).

 

Support calculating certain functions, including f.exists(), f.name(), f.size(), f.date(), f.read(), f.import() and f.export(), on the returned file object.

Parameter:

fd

S3 connection object

bucket

Bucket name

key

Name of a file in the storage bucket

cs

Character set used to save or open an object

Return value:

File object

Example:

 

A

 

1

=s3_open("ASIAVSPDUYZ7O7WTX7C3":"7/5xYPO7a+9Po+IE1ySbmu9UB2hWIkWek1Sqn6E4":"us-east-2":"https://s3.us-east-2.amazonaws.com")

Connect to AWS S3.

2

=s3_file(A1, "test1","emp.txt")

Load emp.txt from bucket test1.

3

=A2.name()

Get a full path containing the file name

4

=A2.exists()

Check if the target file exists.

5

=A2.size()

Return size of the file.

6

=A2.date()

Return date of modification of the file.

7

=A2.read@nv()

Read content from the object.

8

=A2.import@t()

Return file data as a table sequence.

9

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

Retrieve data in the form of cursor.

10

=s3_close(A1)

Close AWS S3 connection.