How to get/return data form subscribe callback?

I would like to get/return data form subscribe callback like this

// in client/
var count;
Meteor.subscribe('posts', function() {
  count = Posts.find().count();
});

or -----------------------------------
var count = Meteor.subscribe('posts', function() {
  return Posts.find().count();
});

alert(count);

This doc (second sample code) shows how to publish the size of a collection.

I want to get data from subscribe callback?

What kind of data are you tying to dig? The count of documents that you’ll get from subscription? Or just count of documents in a collection? Note that count() is a reactive data source. Please try to find out more about reactivity in Meteor!

Tracker.autorun(function() {
    console.log(Posts.find().count());
})