Class FileBuffer
The default file buffer. This is a file buffer that also has a memory buffer to which it writes when the file stream is being read out or if a write to the file failed. This class has no maximum size or any limits attached to it yet. So it is possible for this class to exhaust the memory and/or disk space of the machine using this buffer.
- Defined in: filebuffer.js
Constructor Attributes | Constructor Name and Description |
---|---|
FileBuffer(path, extra)
Creates a new FileBuffer.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
close()
Closes the buffer and releases any external resources contained by this buffer.
|
|
drain()
Drain the buffer raising data events to process each message in the buffer.
|
|
open()
Open this file buffer if not already opened.
|
|
write(outMessage, [callback])
Write a message to the buffer.
|
Class Detail
FileBuffer(path, extra)
Creates a new FileBuffer.
Author: Ivan Porto Carrero.
Author: Ivan Porto Carrero.
- Parameters:
- {String} path
- The path to the file to use as buffer.
- {Object} extra
- The extra configuration options.
Method Detail
-
close()Closes the buffer and releases any external resources contained by this buffer. This method is idempotent.
-
drain()Drain the buffer raising data events to process each message in the buffer. Truncates the buffer after draining.
-
open()Open this file buffer if not already opened. This method is idempotent.
-
write(outMessage, [callback])Write a message to the buffer.
- Parameters:
- {String|Object} outMessage
- The outbound message
- {Function} callback Optional
- The callback