Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titlestorageinfo IDL
collapsetrue
[
    GarbageCollected,
    constructor(DOMString path)
] interface StorageInfo {
    Promise <number> getDeviceSize();
    Promise <StorageDeviceInfo> getDeviceInfo();
}

interface StorageDeviceInfo {
    attribute number size;

    attribute DOMString productName; //@Optional
    attribute DOMString oemID; //@Optional
    attribute DOMStringnumber auSize; //@Optional
    attribute DOMString productRev; //@Optional
    attribute DOMString mfrDate; //@Optional
    	attribute DOMStringnumber serialmfrID; //@Optional
    attribute DOMString signalVoltageserial; //@Optional
    attribute DOMString uhsModesignalVoltage; //@Optional
    attribute numberDOMString specVersionuhsMode; //@Optional
    attribute DOMStringnumber speedClassspecVersion; //@Optional
    attribute numberDOMString mfrIDspeedClass; //@Optional

    attribute DOMString sataModel; //@Optional
    attribute DOMString sataVendor; //@Optional
}

...

Note

The size returned by this method uses a different tool from the size parameter in the StorageDeviceInfo interface. The values returned using the two processes will be approximately, but not exactly, the same.

...

Code Block
languagejs
Promise <StorageDeviceInfo> getDeviceInfo()

Returns a StorageDeviceInfo StorageDeviceInfo  interface containing manufacturer information about the storage device.

...

This interface contains manufacturer information about the storage device. Any of the below parameters may be absent from the interface depending on the device type and the information returned by the device:

  • [Number] sizesize: The total size of the storage device (in bytes)
  • [DOMString] productNameproductName: The product name, as assigned by the device manufacturer (5 bytes for SD, 6 bytes for MMC)
  • [DOMString] oemIDoemID: The two-character card OEM identifier as assigned by the SD Card Association
  • [DOMStringnumber] auSizeauSize: The size of the SD AU in bytes
  • [DOMString] productRevproductRev: The product revision assigned by the device manufacturer
  • [DOMString] mfrDate[DOMString] serialmfrDate: The manufacture date reported by the storage device
  • [Number] mfrID: The card manufacturer ID as assigned by the SD Card Association
  • [DOMString] serial: The serial number of the storage device
  • [DOMString] signalVoltagesignalVoltage: The signal voltage reported by the SD card
  • [DOMString] uhsModeuhsMode: The UHS mode (i.e. BUS speed) reported by the SD card
  • [Number] specVersionspecVersion: The version of SD spec to which the card conforms
  • [DOMString] speedClass
  • [Number] mfrID
  • [DOMString] sataModelspeedClass: The speed class (if any) declared by the SD card
  • [DOMString] sataModel: The SATA model reported by the device
  • [DOMString] sataVendorsataVendor: The SATA vendor reported by the device

Example

Code Block
languagejs
var storageClass = require("@brightsign/storageinfo");
var storage = new storageClass("/storage/usb1");


storage.getDeviceSize().then(
        function(data) {
            console.log(JSON.stringify(data));
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        });

storage.getDeviceInfo().then(
        function(data) {
            console.log(JSON.stringify(data));
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        });

...