节点js readFile toString发出声音

时间:2016-03-24 08:28:40

标签: javascript node.js tostring readfile

我只有一些基本的HTML:

[...]<body>

<p>Some Text</p>
<img src="path/nodejs.jpg?">

</body>[...]

基本节点js用作服务器的请求回调。

 fs.readFile(filePath, function(err, content){
       if (err) throw err;

        // * console.log(content.toString());

        var mime = require('mime').lookup(filePath);
        res.setHeader('Content-Type', mime + "; charset=utf-8");
        res.end(content);
    });

我想要console.log(* line)内容,但是当我这样做时,我的笔记本电脑开始发出嘟嘟声,即发出声音。那么为什么会这样呢?

1 个答案:

答案 0 :(得分:0)

<?php /* Template Name: All posts */ get_header(); ?> </header> <div role="main" id="content" class="content-warp"> <div class="container"> <div id="primary" class="content-area col-md-8 post-list"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <div class="entry"> <?php the_content(); ?> <?php $current_date = ""; $count_posts = wp_count_posts(); $nextpost = 0; $published_posts = $count_posts->publish; $myposts = get_posts(array('posts_per_page' => $published_posts)); foreach ($myposts as $post) : get_template_part('content', 'content-single'); ?> <?php endforeach; ?> </div> </div> <?php endwhile; ?> <?php endif; ?> </div> <?php get_sidebar('page'); ?> <div style="clear:both"></div> </div> </div> <?php get_footer(); ?> 的二进制字节,通过控制台看作ASCII文本会产生一声嘟嘟声。

示例:<?php get_template_part( 'content', 'single' ); ?>

https://en.wikipedia.org/wiki/Bell_character

进行更多阅读

这些天来,遇到它往往是一件令人讨厌的事故而不是有用的事情。