Image for post
Image for post
Photo by Mika Baumeister on Unsplash

This article focus on a few common ways to read a file in Node.js (also using typescript for the code examples).

  1. readline native module
  2. EventStream open source npm library

A common mistake when reading a file line-by-line in Node.js is to read the whole file into memory and then split its content by line breaks. Doing this might overload your system, especially when dealing with large files.

Here is a sample file with many lines which needs to be processed line by line.

readline

Node.js has a native…


Image for post
Image for post

There may be times when you need to compose a new type from already existing string literal union type.

Composing here could be just removing some entries from the original type or adding new ones along with the removal.

What is a String literal Type ?

from TS official documentation: https://www.typescriptlang.org/docs/handbook/advanced-types.html#string-literal-types

String literal types allow you to specify the exact value a string must have. In practice string literal types combine nicely with union types, type guards, and type aliases. You can use these features together to get enum-like behavior with strings.

TLDR; A string literal type can be considered a subtype of the string type. This…


Image for post
Image for post

Introduction

In this article, We will be looking at how to migrate an AWS lambda function deployed as a Serverless application into a Pulumi project without modifying the underlying lambda code.

This article assumes that you have a basic understanding of serverless framework and .

You can find the complete code for this article on GitHub.

Our existing Serverless Framework implementation

Let us first imagine that we have a serverless application with a single lambda function ( createTodo) deployed in AWS. To make it interesting, we will use the code from typescript todo rest api example serverless examples repository.

The project structure could look something like…

Tangledeveloper

Coding articles related to backend e.g. AWS, Java, Typescript, Node, MySQL ... https://tangledeveloper.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store