We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d78310 commit a70f7faCopy full SHA for a70f7fa
lib/ipfs.service.ts
@@ -1,10 +1,10 @@
1
-import { Injectable, Inject } from '@nestjs/common';
+import { Injectable, Inject, OnApplicationShutdown } from '@nestjs/common';
2
import * as IPFS from 'ipfs';
3
import { IPFS_MODULE_OPTIONS } from './ipfs.constants';
4
import { IPFSModuleOptions } from './interfaces';
5
6
@Injectable()
7
-export class IpfsService {
+export class IpfsService implements OnApplicationShutdown {
8
// DEBUG: Give IPFS Node a type when implemented
9
private _ipfsNode: any;
10
@@ -15,4 +15,8 @@ export class IpfsService {
15
? this._ipfsNode
16
: (this._ipfsNode = await IPFS.create(this._ipfsOptions));
17
}
18
+
19
+ async onApplicationShutdown(): Promise<void> {
20
+ await this._ipfsNode && this._ipfsNode.stop();
21
+ }
22
0 commit comments