
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
56 lines
1.6 KiB
Markdown
56 lines
1.6 KiB
Markdown
# `patchRequire(vol[, unixifyPaths[, Module]])`
|
|
|
|
Patches Node's `module` module to use a given *fs-like* object `vol` for module loading.
|
|
|
|
- `vol` - fs-like object
|
|
- `unixifyPaths` *(optional)* - whether to convert Windows paths to unix style paths, defaults to `false`.
|
|
- `Module` *(optional)* - a module to patch, defaults to `require('module')`
|
|
|
|
Monkey-patches the `require` function in Node, this way you can make
|
|
Node.js to *require* modules from your custom filesystem.
|
|
|
|
It expects an object with three filesystem methods implemented that are
|
|
needed for the `require` function to work.
|
|
|
|
```js
|
|
let vol = {
|
|
readFileSync: () => {},
|
|
realpathSync: () => {},
|
|
statSync: () => {},
|
|
};
|
|
```
|
|
|
|
If you want to make Node.js to *require* your files from memory, you
|
|
don't need to implement those functions yourself, just use the
|
|
[`memfs`](https://github.com/streamich/memfs) package:
|
|
|
|
```js
|
|
import {vol} from 'memfs';
|
|
import {patchRequire} from 'fs-monkey';
|
|
|
|
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
|
|
patchRequire(vol);
|
|
require('/foo/bar'); // obi trice
|
|
```
|
|
|
|
Now the `require` function will only load the files from the `vol` file
|
|
system, but not from the actual filesystem on the disk.
|
|
|
|
If you want the `require` function to load modules from both file
|
|
systems, use the [`unionfs`](https://github.com/streamich/unionfs) package
|
|
to combine both filesystems into a union:
|
|
|
|
```js
|
|
import {vol} from 'memfs';
|
|
import {patchRequire} from 'fs-monkey';
|
|
import {ufs} from 'unionfs';
|
|
import * as fs from 'fs';
|
|
|
|
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
|
|
ufs
|
|
.use(vol)
|
|
.use(fs);
|
|
patchRequire(ufs);
|
|
require('/foo/bar.js'); // obi trice
|
|
```
|