FileStat

FileStat

FileStat is a lightweight version of the fs.Stats object built into the core of Node.js. This class exists so that we can create a Stats-like object to pass into the BagItFile constructor when reading from something that is not a normal file system. Most often, this will be a tar file, zip file, or some other serialized format. In those cases, we'd like to be able to read a bag without extracting it from the tar or zip file.

The tar reader emits these lightweight FileStat objects when reading from a serialized file, and other future readers may do the same.

Constructor

new FileStat(optsopt)

Parameters:
Name Type Attributes Description
opts Object <optional>

A optional hash of values.

Properties
Name Type Attributes Default Description
size number <optional>
-1

The size, in bytes, of the file.

mode number <optional>
0o400

The file mode.

uid number <optional>
0

The numeric id of the file owner.

gid number <optional>
0

The numeric id of the file group.

mtimeMs number <optional>
1899-12-31T:00:00:00Z

The time the file was last modified.

isTypeFile number <optional>
false

Indicates whether the item is a file.

isTypeDir number <optional>
false

Indicates whether the item is a directory.

Source:

Members

gid :number

The numeric id of the group that owns the file.

Default Value:
  • 0
Source:

mode :number

The file mode.

Default Value:
  • 0
Source:

mtimeMs :Date

Name is the name of the setting. Setting names should be unique, to prevent confusion.

Default Value:
  • 1899-12-31T:00:00:00Z
Source:

size :number

The size of the file, in bytes.

Default Value:
  • 0
Source:

type :string

Indicates the type of file or object this is. Valid values include: file, link, symlink, directory block-device, character-device, fifo, contiguous-file, and unknown.

Default Value:
  • "unknown"
Source:

uid :number

The numeric id of the user who owns the file.

Default Value:
  • 0
Source:

Methods

isDirectory() → {boolean}

isFile returns the value of this object's isTypeDir property. It exists for compatibility with the interface of Node.js's fs.Stats.

Source:

isFile() → {boolean}

isFile returns the value of this object's isTypeFile property. It exists for compatibility with the interface of Node.js's fs.Stats.

Source: