Skip to content

Instantly share code, notes, and snippets.

View nfacciolo's full-sized avatar

facciolo nfacciolo

View GitHub Profile

Symfony - Serve Private File

Following example demonstrates how to:

  • display a private file download prompt to the user (here for a PDF file)
  • serve a private image or PDF which will be displayed on a webpage

See https://symfony.com/doc/4.4/components/http_foundation.html#serving-files

Host these files in a directory outside of /public, so they can be accessed only through the controller and its @Security() authorization. For example you could create a /private-uploads directory at the root of your project.

@nfacciolo
nfacciolo / client-socket-reconnect.js
Created September 2, 2019 13:05 — forked from sio2boss/client-socket-reconnect.js
Node.js Re-connecting Socket
//
// Simple example of using net.Socket but here we capture the
// right events and attempt to re-establish the connection when
// is is closed either because of an error establishing a
// connection or when the server closes the connection.
//
// Requires
const net = require('net');