profile
viewpoint
Akansh Gulati akanshgulati @ixigo, Ex @wingify India https://www.akansh.com Open Source Language Leader @duckduckgo and front-end artisan.

akanshgulati/commit-semantics 37

Commit semantics is a git aliases installation script to follow a fix format for commits

akanshgulati/covid19-tracker-extension 4

A popup extension to get latest statistics on COVID-19 infected cases globally

akanshgulati/are 2

Library for type checking elements of array

akanshgulati/bk-murli-alexa-skill 1

Alexa audio skill to play brahma kumari murli

akanshgulati/duckduckgo-locales 1

Translation files for duckduckgo.com

akanshgulati/Access-Control-Allow-Origin 0

Chrome extension: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

akanshgulati/angular 0

One framework. Mobile & desktop.

akanshgulati/api 0

Our Database

issue commentlykmapipo/mongoose-gridfs

Write Callback not giving a error or success state

@jakesjews No problem. I tagged you assuming you contributing in core part of package. cc: @lykmapipo

akanshgulati

comment created time in 3 days

issue openedlykmapipo/mongoose-gridfs

Write Callback not giving a error or success state

I am using a CRON job to fetch 50MB around data from remote server and writing that data to MongoDB server.

The issue with current code is that the console.log('data stream formed'); is executed in writeLargeData method, data is being added to mongo DB server but data added successfully is not coming in logs and due to this the parent promise is never resolved. Could you please suggest what's being done wrong.

const { createModel } = require('mongoose-gridfs');
const mongoose = require('mongoose');
const connection = mongoose.connection;
const Readable = require('stream').Readable;
const cron = require('node-cron');
const axios = require('axios');

const ExampleModel = createModel({
  modelName: 'fs',
  connection: connection,
});

async function addDataToMongo(dataStream) {
  const options = ({filename: 'data.txt', contentType: 'text/plain'});
  return new Promise((res, rej)=>{
    ExampleModel.write(options, dataStream, (error, file) => {
      if (error) {
        console.log('error', error);
        rej(error);
        return;
      }
      res(file._id.toString());
      console.log('data added successfully' + file._id.toString());
    });
  });
}

function getReadableStreamFromString(string) {
  let count = 0;
  const chunkSize = 10000;
  return new Readable({
    read() {
      if (count < string.length) {
        this.push(string.slice(count, count + chunkSize));
        count += chunkSize;
      } else {
        this.push(null);
      }
    }
  });
}

async function writeLargeData() {
  const response = await axios.request({
    url: 'https://abc.com',
    method: 'GET',
  });
  console.log('response fetched');
  const dataStream = getReadableStreamFromString(response);
  console.log('data stream formed');
  await addDataToMongo(dataStream);
    
}

cron.schedule('30 12,18,22 * * *', writeLargeData);

@jakesjews Please suggest what should be done in this case.

created time in 4 days

issue commentlykmapipo/mongoose-gridfs

write() callback not working, and connection not closing

@vrmerlin I think you have used await in a wrong way here as when the write process is called it will call callback method and not a promise getting resolved.

You can wrap this login inside a promise to make this work.

vrmerlin

comment created time in 4 days

startedtech-conferences/confs.tech

started time in 16 days

startedgulp-community/gulp-less

started time in a month

issue openedgulp-community/gulp-less

Does it support Gulp v4?

The README.md file says it supports Gulp 3.x version only.

created time in a month

startedokonet/lint-staged

started time in a month

startedgulpjs/gulp

started time in 2 months

startedgatsbyjs/gatsby-starter-theme-workspace

started time in 2 months

push eventakanshgulati/covid19-tracker-extension

Akansh Gulati

commit sha 88a45a5964ab868d5242f19d3cb21a368c67ef3e

feat(Social): Add review and share popups

view details

Akansh Gulati

commit sha 6b877521b063fa7c0fc79168fad6e6ec6cc0dc80

Merge pull request #4 from akanshgulati/social-popups feat(Social): Add review and share popups

view details

push time in 2 months

startedakanshgulati/covid19-tracker-extension

started time in 2 months

create barnchakanshgulati/covid19-tracker-extension

branch : social-popups

created branch time in 2 months

startedritz078/moose

started time in 2 months

push eventakanshgulati/personal-blog-gatsby-markdown

Akansh Gulati

commit sha c288de83bd652abb6c57bde1db238342e6a2da0d

fix(TextAnimation): Update typos, improve text and grammer mistakes

view details

push time in 2 months

push eventakanshgulati/personal-blog-gatsby-markdown

Akansh Gulati

commit sha 379bf02baac01607b8db21fb6f9bf1b1c69680dc

fix(TextAnimation): Update typos and grammer mistakes

view details

Akansh Gulati

commit sha 1d2fde1bedf89f1ec041ce8aad1f4e8759ae67a0

chore(Add excalidraw file):

view details

push time in 2 months

push eventakanshgulati/personal-blog-gatsby-markdown

Akansh Gulati

commit sha 95dd2b447d95c7cf7d2d0ced7fd0f703866e8b53

feat(TextAnimation): Add more content to Text Animation

view details

push time in 2 months

push eventakanshgulati/personal-blog-gatsby-markdown

Akansh Gulati

commit sha bf37162042aa50ef545a2c1ec2ee01f00fcdaec9

feat(TextAnimation): Add CSS based Text animation

view details

Akansh Gulati

commit sha 2b3b739a585c5024330add7f90d84f2291029fc2

Merge pull request #12 from akanshgulati/post-text-animation feat(TextAnimation): Add CSS based Text animation

view details

push time in 2 months

push eventakanshgulati/personal-blog-gatsby-markdown

Akansh Gulati

commit sha 3639bfe621b79b2b01281ddaedfe5dec534dcfe9

chore(Gatsby): Update version of the ghost

view details

push time in 2 months

create barnchakanshgulati/personal-blog-gatsby-markdown

branch : post-text-animation

created branch time in 2 months

created tagakanshgulati/covid19-tracker-extension

tag1.0.3

A popup extension to get latest statistics on COVID-19 infected cases globally

created time in 3 months

push eventakanshgulati/covid19-tracker-extension

Akansh Gulati

commit sha 70ba4f5cf64f8d4bf00984b539d204131884f486

fix(DistrictMode): Add district data support

view details

Akansh Gulati

commit sha 31b003d339eb0038c8e83e78b7e2147cc47d1f6b

fix(Misc): Add animation, formatting long numbers

view details

Akansh Gulati

commit sha c550012483a19119610725696c9bfb4a8d5eb240

fix(VersionBump):

view details

Akansh Gulati

commit sha 6127c80dfe95dc144332e2c8155e3ee33d277b0e

Merge pull request #3 from akanshgulati/district-data District data

view details

push time in 3 months

push eventakanshgulati/covid19-tracker-extension

Akansh Gulati

commit sha c550012483a19119610725696c9bfb4a8d5eb240

fix(VersionBump):

view details

push time in 3 months

push eventakanshgulati/covid19-tracker-extension

Akansh Gulati

commit sha 31b003d339eb0038c8e83e78b7e2147cc47d1f6b

fix(Misc): Add animation, formatting long numbers

view details

push time in 3 months

create barnchakanshgulati/covid19-tracker-extension

branch : district-data

created branch time in 3 months

push eventakanshgulati/covid-backend

Akansh Gulati

commit sha 963f4ac9fc88951ea05ae5c9362ce006c0ba7b6a

fix(DistrictData): Add district info for india

view details

push time in 3 months

create barnchakanshgulati/covid-backend

branch : district-data

created branch time in 3 months

more