L
L
LinuxGod2021-04-04 18:52:57
PHP
LinuxGod, 2021-04-04 18:52:57

How to rewrite this code from PHP to Node JS?

<?php
$st = new Memcache;
$st->connect('127.0.0.1', 11033);

$file = "/var/www/files/base/2048.png"; // полный путь к локальному файлу

$ext = pathinfo($file, PATHINFO_EXTENSION);
$volume_id = 1000;

$ret = $st->get("file{$volume_id},{$file}");

if ($ret !== false) {
    list($secret, $local_id) = explode (",", $ret);
    $link = "http://vk.com/v{$volume_id}/{$local_id}/{$secret}.{$ext}";
} else
    die('upload error');
?>
<a target="_blank" href="<?=$link?>"><?=$link?></a>


How to use memcache in node js?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question