How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • res.sendFile = async (buffer,filename,mime)=>{
            if(typeof buffer == 'string' && /\.\w+$/.test(buffer)) buffer = await fs.readFile(buffer);
    
            res.writeHead(200, {
                "Content-Type": mime || "application/octet-stream",
                "Content-Disposition": "attachment; filename=" + encodeURI(filename)
            });
            res.end(buffer);
        }
    
        
    /AlexxNB/doconv mit
  • var MemoryFileSystem = require("memory-fs");
    var fs = new MemoryFileSystem(); // Optionally pass a javascript object
    // Optionally pass a javascript object
     
    fs.mkdirpSync("/a/test/dir");
    fs.writeFileSync("/a/test/dir/file.txt", "Hello World");
    fs.readFileSync("/a/test/dir/file.txt"); // returns Buffer("Hello World")
    // returns Buffer("Hello World")
     
    // Async variants too
    // Async variants too
    fs.unlink("/a/test/dir/file.txt", function(err) {
        // ...
    // ...
    });
     
    fs.readdirSync("/a/test"); // returns ["dir"]
    // returns ["dir"]
    fs.statSync("/a/test/dir").isDirectory(); // returns true
    // returns true
    fs.rmdirSync("/a/test/dir");
     
    fs.mkdirpSync("C:\\use\\windows\\style\\paths");
    Docs
  • const writeData = Buffer.from('my text data', 'utf8');
    vscode.workspace.fs.writeFile(fileUri, writeData);
    Docs
  • const read = async () => {
                        const buffer = await fs.readFile(file.path);
                        remove();
                        return buffer;
                    }
    
                    
    /AlexxNB/doconv mit
  • import {Component, NgModule} from '@angular/core'
    import {render, screen} from '@testing-library/angular'
    import {ngMocks} from 'ng-mocks'
    
    @Component({
      selector: 'app-parent-component',
      template: '<app-child-component></app-child-component>',
    })
    class ParentComponent {}
    
    @Component({
      selector: 'app-child-component',
      template: '<p>Child component</p>',
    })
    class ChildComponent {}
    
    @NgModule({
      declarations: [ParentComponent, ChildComponent],
    })
    export class AppModule {}
    
    describe('ParentComponent', () => {
      it('should not render ChildComponent when shallow rendering', async () => {
        const dependencies = ngMocks.guts(null, AppModule, ParentComponent)
    
        await render(ParentComponent, dependencies)
    
        expect(screen.queryByText('Child component')).toBeNull()
      })
    })
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples