- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
67 lines
1.8 KiB
Markdown
67 lines
1.8 KiB
Markdown
## _readline_
|
|
> Read a file line by line.
|
|
|
|
## Install
|
|
|
|
## Important. In node 10 there is a core module named readline. Please use linebyline instead, it is the same module just renamed:
|
|
[Npm linebyline](https://www.npmjs.com/package/linebyline)
|
|
|
|
```sh
|
|
npm install linebyline
|
|
```
|
|
|
|
## Test
|
|
```sh
|
|
npm install .
|
|
npm test
|
|
|
|
```
|
|
|
|
|
|
## What's this?
|
|
|
|
Simple streaming readline module for NodeJS. Reads a file and buffers new lines emitting a _line_ event for each line.
|
|
|
|
## Usage
|
|
### Simple
|
|
```js
|
|
var readline = require('linebyline'),
|
|
rl = readline('./somefile.txt');
|
|
rl.on('line', function(line, lineCount, byteCount) {
|
|
// do something with the line of text
|
|
})
|
|
.on('error', function(e) {
|
|
// something went wrong
|
|
});
|
|
```
|
|
|
|
### ASCII file decoding
|
|
As the underlying `fs.createReadStream` doesn't care about the specific ASCII encoding of the file, an alternative way to decode the file is by telling the `readline` library to retain buffer and then decoding it using a converter (e.g. [`iconv-lite`](https://www.npmjs.com/package/iconv-lite)).
|
|
```js
|
|
var readline = require('linebyline'),
|
|
rl = readline('./file-in-win1251.txt', {
|
|
retainBuffer: true //tell readline to retain buffer
|
|
});
|
|
rl.on("line", function (data,linecount){
|
|
var line = iconv.decode(data, 'win1251');
|
|
// do something with the line of converted text
|
|
});
|
|
```
|
|
##API
|
|
## readLine(readingObject[, options])
|
|
### Params:
|
|
|
|
* `readingObject` - file path or stream object
|
|
* `options` can include:
|
|
* `maxLineLength` - override the default 4K buffer size (lines longer than this will not be read)
|
|
* `retainBuffer` - avoid converting to String prior to emitting 'line' event; will pass raw buffer with encoded data to the callback
|
|
|
|
### Return:
|
|
|
|
* **EventEmitter**
|
|
|
|
|
|
## License
|
|
|
|
BSD © [Craig Brookes](http://craigbrookes.com/)
|