This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sharp = require('sharp'); | |
| const fs = require('fs'); | |
| const { isArray } = require('util'); | |
| async function run() { | |
| // single face | |
| const image = await faceFrame('test.jpg', [171, 706, 439, 438], '#005CC5', 3); | |
| await image.toFile('result-test.jpg'); | |
| // multiple face1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createReadStream, statSync } from 'fs'; | |
| export const videoStream = (req: any, path: string) => { | |
| const stat = statSync(path); | |
| const fileSize = stat.size; | |
| const range = req.headers.range; | |
| const res = req.res; | |
| if (range) { | |
| const parts = range.replace(/bytes=/, '').split('-'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { AppController } from './controllers/app.controller'; | |
| import { AppService } from './services/app.service'; | |
| import { ConfigModule } from './modules/config/config.module'; | |
| @Module({ | |
| imports: [ConfigModule], | |
| controllers: [AppController], | |
| providers: [AppService], | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ApplicationContext } from './app.context'; | |
| import { ConfigService } from './modules/config/config.service'; | |
| async function bootstrap() { | |
| const app = await ApplicationContext(); | |
| await app.listen(app.get(ConfigService).getInt('APP_PORT')); | |
| } | |
| bootstrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { ConfigService } from './config.service'; | |
| @Module({ | |
| providers: [ | |
| { | |
| provide: ConfigService, | |
| useValue: new ConfigService('.env'), | |
| }, | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable, Logger } from '@nestjs/common'; | |
| import * as dotenv from 'dotenv'; | |
| import * as fs from 'fs'; | |
| dotenv.config(); | |
| @Injectable() | |
| export class ConfigService { | |
| private readonly envConfig: { [key: string]: string }; | |
| constructor(filePath: string) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@nestjs/common'; | |
| @Injectable() | |
| export class AppService { | |
| getHello(): string { | |
| return 'Hello World!'; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Controller, Get } from '@nestjs/common'; | |
| import { AppService } from './app.service'; | |
| @Controller() | |
| export class AppController { | |
| constructor(private readonly appService: AppService) {} | |
| @Get() | |
| getHello(): string { | |
| return this.appService.getHello(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { AppController } from './app.controller'; | |
| import { AppService } from './app.service'; | |
| @Module({ | |
| imports: [], | |
| controllers: [AppController], | |
| providers: [AppService], | |
| }) | |
| export class AppModule {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ApplicationContext } from './app.context'; | |
| async function bootstrap() { | |
| const app = await ApplicationContext(); | |
| await app.listen(3000); | |
| } | |
| bootstrap(); |