Show:

GDAL VSI layer file operations

Static Methods

gdal.fs.readDir
(
  • directory
)
String[]

Defined in src/gdal_fs.cpp:161

Read file names in a directory.

Parameters:

  • directory String

Returns:

String[]
gdal.fs.readDirAsync
(
  • directory
  • callback=undefined
)
Promise[]

Defined in src/gdal_fs.cpp:171

Read file names in a directory.

Parameters:

  • directory String
  • [callback=undefined] Callback[] optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise[]
gdal.fs.stat
(
  • filename
  • bigint=false
)
gdal.VSIStat

Defined in src/gdal_fs.cpp:18

Get VSI file info.

Parameters:

  • filename String
  • [bigint=false] Boolean optional

    Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53.

Returns:

gdal.VSIStat

Example:

const gdalStats = gdal.fs.stat('/vsis3/noaa-gfs-bdp-pds/gfs.20210918/06/atmos/gfs.t06z.pgrb2.0p25.f010')
if ((gdalStats.mode & fs.constants.S_IFREG) === fs.constants.S_IFREG) console.log('is regular file')

// convert to Node.js fs.Stats
const fsStats = new (Function.prototype.bind.apply(fs.Stats, [null, ...Object.keys(s).map(k => s[k])]))
if (fsStats.isFile) console.log('is regular file')
gdal.fs.stat
(
  • filename
  • True
)
gdal.VSIStat64

Defined in src/gdal_fs.cpp:39

Get VSI file info.

Parameters:

  • filename String
  • True True

    Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53.

Returns:

gdal.VSIStat64
gdal.fs.statAsync
(
  • filename
  • bigint=false
  • callback=undefined
)
Promise

Defined in src/gdal_fs.cpp:50

Get VSI file info. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • filename String
  • [bigint=false] Boolean optional

    Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53.

  • [callback=undefined] callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
gdal.fs.statAsync
(
  • filename
  • True
  • callback=undefined
)
Promise

Defined in src/gdal_fs.cpp:63

Get VSI file info. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • filename String
  • True True

    Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53.

  • [callback=undefined] callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise