IC.Standalone - imonology/ImonCloud-Doc GitHub Wiki

IC.Standalone API列表

IC.Standalone

IC.Standalone 不依賴任何 *.js 或其它外部套件,因此它可以獨立執行。 IC.Standalone 依賴 Node.js APIs 內建函式功能或是套件。 IC.Standalone 會儘量相容於各平台, Mocha 測試工具能含蓋。

Implementation of this API do not depend on other *.js files as well as external packages, so this API can be run independently. This API depends only Node.js APIs or packages in bare Node.js. The API also supports multiple platforms as compatible as possible. Mocha also covers functions in the API.

deleteChannel() -- 刪除一個 video channel

getChannel() -- 取得一個 video channel

setChannel() -- 新增/設定一個 video channel

getStatus() -- 取得 IC.Video 狀態

query() -- 查詢已存檔錄影

setDiskFullAction() -- 設定當磁碟屆滿時的動作

setNotify() -- 設定通知 callback function

stdinWrite() -- 對某個 channel 寫入 stdin

stopAllStream() -- 停止所有錄影/串流

record.start() -- 開始錄影

record.stop() -- 停止錄影

stream.start() -- 開始串流

stream.stop() -- 停止串流

---------------------------------------------------------------

result = compare2arrays(array1, array2);

功能說明

IC.Standalone.compare2arrays 比較二個輸入的陣列的所有元素,並且回傳是否相同。 注意: 此功能目前只支援陣列內單純元素的比對,例如陣列內只含數字、整數、字串、布林值。不能含有物件或是巢狀陣列。

This function returns that the given two arrays are identical or not. note: This function currently supports only simple arrays with only simple elements, such as numbers, integers, and boolean. Objects and arrays cannot be included.

變數說明

  • 傳入(input)

    • [], []

      變數類型: 陣列

      變數說明: 資料

  • 傳出(callback)

  • 回傳(return)

    • return Boolean;

      變數類型: Boolean

      變數說明: 回傳是否相同。

---------------------------------------------------------------

result = IC.Standalone.cleanArray(arr);

功能說明

刪除輸入陣列中的空元素,並回傳。 This function gets rid of empty elements in the given array, and returns an array.

變數說明

  • 傳入(input)

    • []

      變數類型: Array

      變數說明: 資料

  • 傳出(callback)

  • 回傳(return)

    • return [];

      變數類型: Array

      變數說明: 回傳是否為 Binary。

---------------------------------------------------------------

IC.Standalone.diskSpace({onDone: });

功能說明

此功能會回傳磁碟空間、已使用空間、剩餘空間。 This function gets information about disk spaces, used spaces, and free spaces.

變數說明

  • 傳入(input)

    • onDone

      變數類型: Function

      變數說明: 用來接收回傳的資料

  • 傳出(callback)

onDone: function (result) {} Just put a callback function named onDone to receive returned results. {err: , disk: }

The returned result will be an object with two items, err and disk.

If (err === null) indicates that no error occurs, otherwise err returns error messages. Your can use disk information if no error occurs.

  • 回傳(return)

---------------------------------------------------------------

IC.Standalone.isEnoughDiskSpace();

功能說明

查詢某個 partition 或 drive 空間是否足夠。

變數說明

  • 傳入(input)

    • {path: , K: , onDone: }

      變數類型: Object

      path: 要偵測的路徑 b: 指定 bytes 數量 K: 指定 KB M: 指定 MB G: 指定 GB

      變數說明: 資料

  • 傳出(callback)

    • (err, result, remaining)

      變數類型: 有三項

      變數說明: err: 回傳是執行過程否有出現問題。 result: 空間是否足夠。 remaining: 扣掉指定的空間後,還剩餘空間。

  • 回傳(return)

    • return Boolean;

      變數類型: Boolean

      變數說明: 回傳是執行過程否有出現問題。

---------------------------------------------------------------

whichPartition({path: , onDone: });

功能說明

輸入路徑,並回傳此路徑屬於何分割區。 When give an existing path, this function returns corresponding partition by onDone callback function.

變數說明

  • 傳入(input)

    • {path: , onDone: }

      變數類型: Object

      變數說明: 資料

  • 傳出(callback)

    • (err, {resolvedPath: , mount: , drive: }) onDone: err: 若執行過程有任何錯誤,回傳 false。 resolvedPath: 經過處理的路徑 mount: 若系統是 *x 則回傳掛載點 mount point, 例如 / drive: 若系統是 Windows 則回傳磁碟代號,例如 A: ~ Z:
  • 回傳(return)

    • return Boolean;

      變數類型: Boolean

      變數說明: 若執行過程有任何錯誤,回傳 false。

Input

path: The path is a string. If given path exists, onDone callback function will return corresponding partition. If given path does not exist, return an error message.

onDone: callback function

output

err, {resolvedPath: , mount: }

{err: , resolvedPath: , mount: }